| @@ 55-78 (lines=24) @@ | ||
| 52 | * |
|
| 53 | * @return ExifMapper |
|
| 54 | */ |
|
| 55 | private static function getExifMapper() |
|
| 56 | { |
|
| 57 | $exifMapper = new ExifMapper(); |
|
| 58 | ||
| 59 | // find all classes |
|
| 60 | $reflClass = new \ReflectionClass(self::class); |
|
| 61 | $namespace = $reflClass->getNamespaceName(); |
|
| 62 | $namespace .= '\\Mapper\\Exif'; |
|
| 63 | ||
| 64 | $path = realpath(__DIR__ . '/Mapper/Exif'); |
|
| 65 | ||
| 66 | foreach (glob($path . '/*Mapper.php') as $classPath) { |
|
| 67 | $className = str_replace('.php', '', array_reverse( |
|
| 68 | explode(DIRECTORY_SEPARATOR, $classPath) |
|
| 69 | )[0]); |
|
| 70 | $fqcn = $namespace . '\\' . $className; |
|
| 71 | ||
| 72 | $fieldMapper = new $fqcn(); |
|
| 73 | ||
| 74 | $exifMapper->registerFieldMapper($fieldMapper); |
|
| 75 | } |
|
| 76 | ||
| 77 | return $exifMapper; |
|
| 78 | } |
|
| 79 | ||
| 80 | /** |
|
| 81 | * Returns the mapper for Iptc data |
|
| @@ 85-108 (lines=24) @@ | ||
| 82 | * |
|
| 83 | * @return IptcMapper |
|
| 84 | */ |
|
| 85 | private static function getIptcMapper() |
|
| 86 | { |
|
| 87 | $iptcMapper = new IptcMapper(); |
|
| 88 | ||
| 89 | // find all classes |
|
| 90 | $reflClass = new \ReflectionClass(self::class); |
|
| 91 | $namespace = $reflClass->getNamespaceName(); |
|
| 92 | $namespace .= '\\Mapper\\Iptc'; |
|
| 93 | ||
| 94 | $path = realpath(__DIR__ . '/Mapper/Iptc'); |
|
| 95 | ||
| 96 | foreach (glob($path . '/*Mapper.php') as $classPath) { |
|
| 97 | $className = str_replace('.php', '', array_reverse( |
|
| 98 | explode(DIRECTORY_SEPARATOR, $classPath) |
|
| 99 | )[0]); |
|
| 100 | $fqcn = $namespace . '\\' . $className; |
|
| 101 | ||
| 102 | $fieldMapper = new $fqcn(); |
|
| 103 | ||
| 104 | $iptcMapper->registerFieldMapper($fieldMapper); |
|
| 105 | } |
|
| 106 | ||
| 107 | return $iptcMapper; |
|
| 108 | } |
|
| 109 | } |
|
| 110 | ||