Factory for standard Writer
public static create ( Psr\Log\LoggerInterface $logger ) : |
||
$logger | Psr\Log\LoggerInterface | |
리턴 |
/** * @covers MediaVorus\MediaCollection::match */ public function testMatch() { $logger = new Logger('test'); $logger->pushHandler(new NullHandler()); $mediavorus = new MediaVorus(Reader::create($logger), Writer::create($logger), FFProbe::create()); $collection = $mediavorus->inspectDirectory(__DIR__ . '/../../files/'); $audio = $collection->match(new MediaType(MediaInterface::TYPE_AUDIO)); $this->assertInstanceOf('\\Doctrine\\Common\\Collections\\ArrayCollection', $audio); $this->assertGreaterThan(0, $audio->count()); foreach ($audio as $audio) { $this->assertEquals(MediaInterface::TYPE_AUDIO, $audio->getType()); } $notAudio = $collection->match(new MediaType(MediaInterface::TYPE_AUDIO), true); $this->assertGreaterThan(0, $notAudio->count()); $this->assertInstanceOf('\\Doctrine\\Common\\Collections\\ArrayCollection', $notAudio); foreach ($notAudio as $audio) { $this->assertFalse(MediaInterface::TYPE_AUDIO === $audio->getType()); } }
/** * Instantiate mediavorus to register the mime types */ public function setUp() { parent::setUp(); $logger = new Logger('test'); $logger->pushHandler(new NullHandler()); $mediavorus = new MediaVorus(Reader::create($logger), Writer::create($logger), FFProbe::create()); }
public function setUp() { parent::setUp(); $logger = new Logger('Tests'); $logger->pushHandler(new NullHandler()); $reader = Reader::create($logger); $writer = Writer::create($logger); $file = __DIR__ . '/../../../files/ExifTool.jpg'; $this->object = new DefaultMedia(new File($file), $reader->reset()->files($file)->first(), $writer); $file = __DIR__ . '/../../../files/GPS.jpg'; $this->GPSobject = new DefaultMedia(new File($file), $reader->reset()->files($file)->first(), $writer); }
public function setUp() { parent::setUp(); $logger = new Logger('Tests'); $logger->pushHandler(new NullHandler()); $this->reader = Reader::create($logger); $this->writer = Writer::create($logger); $file = __DIR__ . '/../../../files/ExifTool.jpg'; $this->object = new Image(new File($file), $this->reader->reset()->files($file)->first(), $this->writer); $logger = new Logger('test'); $logger->pushHandler(new NullHandler()); $this->ffprobe = FFProbe::create(); $this->mediavorus = new MediaVorus($this->reader, $this->writer, $this->ffprobe); }
public function process() { if (!$this->target) { $this->modx->log(1, 'target is empty'); return false; } $logger = new Logger('exiftool'); $Writer = Writer::create($logger); $bag = new MetadataBag(); $this->modx->invokeEvent('OnModExifMetaTagAdd', array('writer' => &$this, 'metadataBag' => &$bag, 'tags' => $this->exif)); $ok = $Writer->write($this->target, $bag); if (is_null($ok)) { $this->modx->log(1, 'Metadata bag is empty'); return true; } elseif (!$ok) { return false; } return true; }
/** * Create MediaVorus * * @return MediaVorus */ public static function create() { $logger = new Logger('MediaVorus'); $logger->pushHandler(new NullHandler()); return new static(Reader::create($logger), Writer::create($logger), FFProbe::create(array(), $logger)); }