コード例 #1
0
 public function testGetCollection()
 {
     $mediaTypes = new MediaTypeCollection();
     $mediaTypes->add(new MediaType('gif', 'image', ['image/gif']));
     $classifier = new MediaClassifier($mediaTypes, 'image:gif');
     $this->assertSame($mediaTypes, $classifier->getCollection());
 }
コード例 #2
0
 /**
  * {@inheritdoc}
  */
 public function extract($filename, Specification $targetFormat)
 {
     $mediaType = $this->mediaClassifier->classify($filename);
     if (!$mediaType) {
         return null;
     }
     $extractor = $this->resolver->resolve($filename, $mediaType, $targetFormat);
     if (!$extractor) {
         return null;
     }
     return $extractor->extract($filename, $targetFormat);
 }