Author: Thomas Müller (t_mueller_stolzenhain@yahoo.de)
Inheritance: implements Browscap\Writer\WriterInterface, implements Browscap\Writer\WriterNeedsExpanderInterface
Exemplo n.º 1
0
 /**
  * @param \Psr\Log\LoggerInterface $logger
  * @param string                   $buildFolder
  * @param string|null              $file
  *
  * @return \Browscap\Writer\WriterCollection
  */
 public function createCollection(LoggerInterface $logger, $buildFolder, $file = null)
 {
     $writerCollection = new WriterCollection();
     if (null === $file) {
         $file = $buildFolder . '/full_php_browscap.ini';
     }
     $fullFilter = new FullFilter();
     $fullPhpWriter = new IniWriter($file);
     $formatter = new PhpFormatter();
     $fullPhpWriter->setLogger($logger)->setFormatter($formatter->setFilter($fullFilter))->setFilter($fullFilter);
     return $writerCollection->addWriter($fullPhpWriter);
 }
Exemplo n.º 2
0
 /**
  * @param \Psr\Log\LoggerInterface $logger
  * @param string                   $buildFolder
  *
  * @return \Browscap\Writer\WriterCollection
  */
 public function createCollection(LoggerInterface $logger, $buildFolder)
 {
     $writerCollection = new WriterCollection();
     $fullFilter = new FullFilter();
     $stdFilter = new StandardFilter();
     $liteFilter = new LiteFilter();
     $fullAspWriter = new IniWriter($buildFolder . '/full_asp_browscap.ini');
     $formatter = new AspFormatter();
     $fullAspWriter->setLogger($logger)->setFormatter($formatter->setFilter($fullFilter))->setFilter($fullFilter);
     $writerCollection->addWriter($fullAspWriter);
     $fullPhpWriter = new IniWriter($buildFolder . '/full_php_browscap.ini');
     $formatter = new PhpFormatter();
     $fullPhpWriter->setLogger($logger)->setFormatter($formatter->setFilter($fullFilter))->setFilter($fullFilter);
     $writerCollection->addWriter($fullPhpWriter);
     $stdAspWriter = new IniWriter($buildFolder . '/browscap.ini');
     $formatter = new AspFormatter();
     $stdAspWriter->setLogger($logger)->setFormatter($formatter->setFilter($stdFilter))->setFilter($stdFilter);
     $writerCollection->addWriter($stdAspWriter);
     $stdPhpWriter = new IniWriter($buildFolder . '/php_browscap.ini');
     $formatter = new PhpFormatter();
     $stdPhpWriter->setLogger($logger)->setFormatter($formatter->setFilter($stdFilter))->setFilter($stdFilter);
     $writerCollection->addWriter($stdPhpWriter);
     $liteAspWriter = new IniWriter($buildFolder . '/lite_asp_browscap.ini');
     $formatter = new AspFormatter();
     $liteAspWriter->setLogger($logger)->setFormatter($formatter->setFilter($liteFilter))->setFilter($liteFilter);
     $writerCollection->addWriter($liteAspWriter);
     $litePhpWriter = new IniWriter($buildFolder . '/lite_php_browscap.ini');
     $formatter = new PhpFormatter();
     $litePhpWriter->setLogger($logger)->setFormatter($formatter->setFilter($liteFilter))->setFilter($liteFilter);
     $writerCollection->addWriter($litePhpWriter);
     $csvWriter = new CsvWriter($buildFolder . '/browscap.csv');
     $formatter = new CsvFormatter();
     $csvWriter->setLogger($logger)->setFormatter($formatter->setFilter($fullFilter))->setFilter($fullFilter);
     $writerCollection->addWriter($csvWriter);
     $xmlWriter = new XmlWriter($buildFolder . '/browscap.xml');
     $formatter = new XmlFormatter();
     $xmlWriter->setLogger($logger)->setFormatter($formatter->setFilter($stdFilter))->setFilter($stdFilter);
     $writerCollection->addWriter($xmlWriter);
     $jsonWriter = new JsonWriter($buildFolder . '/browscap.json');
     $formatter = new JsonFormatter();
     $jsonWriter->setLogger($logger)->setFormatter($formatter->setFilter($fullFilter))->setFilter($fullFilter);
     $writerCollection->addWriter($jsonWriter);
     $liteJsonWriter = new JsonWriter($buildFolder . '/lite_browscap.json');
     $formatter = new JsonFormatter();
     $liteJsonWriter->setLogger($logger)->setFormatter($formatter->setFilter($liteFilter))->setFilter($liteFilter);
     $writerCollection->addWriter($liteJsonWriter);
     return $writerCollection;
 }
Exemplo n.º 3
0
 /**
  * @param \Psr\Log\LoggerInterface $logger
  * @param string                   $buildFolder
  *
  * @return \Browscap\Writer\WriterCollection
  */
 public function createCollection(LoggerInterface $logger, $buildFolder)
 {
     $writerCollection = new WriterCollection();
     $fullFilter = new FullFilter();
     $stdFilter = new StandardFilter();
     $liteFilter = new LiteFilter();
     $fullPhpWriter = new IniWriter($buildFolder . '/full_php_browscap.ini');
     $formatter = new PhpFormatter();
     $fullPhpWriter->setLogger($logger)->setFormatter($formatter->setFilter($fullFilter))->setFilter($fullFilter);
     $writerCollection->addWriter($fullPhpWriter);
     $stdPhpWriter = new IniWriter($buildFolder . '/php_browscap.ini');
     $formatter = new PhpFormatter();
     $stdPhpWriter->setLogger($logger)->setFormatter($formatter->setFilter($stdFilter))->setFilter($stdFilter);
     $writerCollection->addWriter($stdPhpWriter);
     $litePhpWriter = new IniWriter($buildFolder . '/lite_php_browscap.ini');
     $formatter = new PhpFormatter();
     $litePhpWriter->setLogger($logger)->setFormatter($formatter->setFilter($liteFilter))->setFilter($liteFilter);
     $writerCollection->addWriter($litePhpWriter);
     return $writerCollection;
 }
Exemplo n.º 4
0
 /**
  * @param \Psr\Log\LoggerInterface $logger
  * @param string                   $buildFolder
  * @param string|null              $file
  * @param array                    $fields
  * @param string                   $format
  *
  * @return \Browscap\Writer\WriterCollection
  */
 public function createCollection(LoggerInterface $logger, $buildFolder, $file = null, $fields = array(), $format = self::OUTPUT_FORMAT_PHP)
 {
     $writerCollection = new WriterCollection();
     if (null === $file) {
         switch ($format) {
             case self::OUTPUT_FORMAT_ASP:
                 $file = $buildFolder . '/full_browscap.ini';
                 break;
             case self::OUTPUT_FORMAT_CSV:
                 $file = $buildFolder . '/browscap.csv';
                 break;
             case self::OUTPUT_FORMAT_XML:
                 $file = $buildFolder . '/browscap.xml';
                 break;
             case self::OUTPUT_FORMAT_JSON:
                 $file = $buildFolder . '/browscap.json';
                 break;
             case self::OUTPUT_FORMAT_PHP:
             default:
                 $file = $buildFolder . '/full_php_browscap.ini';
                 break;
         }
     }
     $filter = new CustomFilter($fields);
     switch ($format) {
         case self::OUTPUT_FORMAT_ASP:
             $writer = new Writer\IniWriter($file);
             $formatter = new Formatter\AspFormatter();
             break;
         case self::OUTPUT_FORMAT_CSV:
             $writer = new Writer\CsvWriter($file);
             $formatter = new Formatter\CsvFormatter();
             break;
         case self::OUTPUT_FORMAT_XML:
             $writer = new Writer\XmlWriter($file);
             $formatter = new Formatter\XmlFormatter();
             break;
         case self::OUTPUT_FORMAT_JSON:
             $writer = new Writer\JsonWriter($file);
             $formatter = new Formatter\JsonFormatter();
             break;
         case self::OUTPUT_FORMAT_PHP:
         default:
             $writer = new Writer\IniWriter($file);
             $formatter = new Formatter\PhpFormatter();
             break;
     }
     $writer->setLogger($logger)->setFormatter($formatter->setFilter($filter))->setFilter($filter);
     $writerCollection->addWriter($writer);
     return $writerCollection;
 }
Exemplo n.º 5
0
 /**
  * tests rendering the footer after all divisions
  *
  * @group writer
  * @group sourcetest
  */
 public function testRenderAllDivisionsFooter()
 {
     self::assertSame($this->object, $this->object->renderAllDivisionsFooter());
     self::assertSame('', file_get_contents($this->file));
 }