Exemple #1
0
 public function testGetExtensions()
 {
     $extensions = Type::getExtensions();
     $this->assertContains('jpeg', $extensions);
     $this->assertContains('jpg', $extensions);
 }
Exemple #2
0
 protected function getTypeFromMetadata($metadata)
 {
     $ext = pathinfo($metadata['path'], PATHINFO_EXTENSION);
     if (in_array($ext, Handler\Image\Type::getExtensions())) {
         return 'image';
     } elseif ($ext === 'json') {
         return 'json';
     } elseif ($ext === 'yaml' || $ext === 'yml') {
         return 'yaml';
     } elseif (in_array($ext, $this->getDocumentExtensions())) {
         return 'document';
     }
     return $metadata['type'];
 }
Exemple #3
0
 private function getTypeFromPath($path)
 {
     $ext = pathinfo($path, PATHINFO_EXTENSION);
     if (in_array($ext, Handler\Image\Type::getExtensions())) {
         return 'image';
     } elseif ($ext === 'json') {
         return 'json';
     } elseif ($ext === 'yaml' || $ext === 'yml') {
         return 'yaml';
     } elseif (in_array($ext, $this->getDocumentExtensions())) {
         return 'document';
     }
     return null;
 }