@@ 25-54 (lines=30) @@ | ||
22 | * @category PHPExif |
|
23 | * @package Native |
|
24 | */ |
|
25 | class DateTimeFieldMapper implements FieldMapper |
|
26 | { |
|
27 | use GuardInvalidArgumentsForExifTrait; |
|
28 | ||
29 | /** |
|
30 | * {@inheritDoc} |
|
31 | */ |
|
32 | public function getSupportedFields() |
|
33 | { |
|
34 | return array( |
|
35 | DateTimeImmutable::class, |
|
36 | ); |
|
37 | } |
|
38 | ||
39 | /** |
|
40 | * {@inheritDoc} |
|
41 | */ |
|
42 | public function mapField($field, array $input, &$output) |
|
43 | { |
|
44 | $this->guardInvalidArguments($field, $input, $output); |
|
45 | ||
46 | if (!array_key_exists('datetimeoriginal', $input)) { |
|
47 | return; |
|
48 | } |
|
49 | ||
50 | $datetimeOriginal = new DateTimeImmutable($input['datetimeoriginal']); |
|
51 | ||
52 | $output = $output->withCreationDate($datetimeOriginal); |
|
53 | } |
|
54 | } |
|
55 |
@@ 25-54 (lines=30) @@ | ||
22 | * @category PHPExif |
|
23 | * @package Native |
|
24 | */ |
|
25 | class ExposureTimeFieldMapper implements FieldMapper |
|
26 | { |
|
27 | use GuardInvalidArgumentsForExifTrait; |
|
28 | ||
29 | /** |
|
30 | * {@inheritDoc} |
|
31 | */ |
|
32 | public function getSupportedFields() |
|
33 | { |
|
34 | return array( |
|
35 | ExposureTime::class, |
|
36 | ); |
|
37 | } |
|
38 | ||
39 | /** |
|
40 | * {@inheritDoc} |
|
41 | */ |
|
42 | public function mapField($field, array $input, &$output) |
|
43 | { |
|
44 | $this->guardInvalidArguments($field, $input, $output); |
|
45 | ||
46 | if (!array_key_exists('exposuretime', $input)) { |
|
47 | return; |
|
48 | } |
|
49 | ||
50 | $iso = new ExposureTime($input['exposuretime']); |
|
51 | ||
52 | $output = $output->withExposureTime($iso); |
|
53 | } |
|
54 | } |
|
55 |
@@ 25-54 (lines=30) @@ | ||
22 | * @category PHPExif |
|
23 | * @package Native |
|
24 | */ |
|
25 | class FilenameFieldMapper implements FieldMapper |
|
26 | { |
|
27 | use GuardInvalidArgumentsForExifTrait; |
|
28 | ||
29 | /** |
|
30 | * {@inheritDoc} |
|
31 | */ |
|
32 | public function getSupportedFields() |
|
33 | { |
|
34 | return array( |
|
35 | Filename::class, |
|
36 | ); |
|
37 | } |
|
38 | ||
39 | /** |
|
40 | * {@inheritDoc} |
|
41 | */ |
|
42 | public function mapField($field, array $input, &$output) |
|
43 | { |
|
44 | $this->guardInvalidArguments($field, $input, $output); |
|
45 | ||
46 | if (!array_key_exists('filename', $input)) { |
|
47 | return; |
|
48 | } |
|
49 | ||
50 | $filename = new Filename($input['filename']); |
|
51 | ||
52 | $output = $output->withFilename($filename); |
|
53 | } |
|
54 | } |
|
55 |
@@ 25-54 (lines=30) @@ | ||
22 | * @category PHPExif |
|
23 | * @package Native |
|
24 | */ |
|
25 | class FilesizeFieldMapper implements FieldMapper |
|
26 | { |
|
27 | use GuardInvalidArgumentsForExifTrait; |
|
28 | ||
29 | /** |
|
30 | * {@inheritDoc} |
|
31 | */ |
|
32 | public function getSupportedFields() |
|
33 | { |
|
34 | return array( |
|
35 | Filesize::class, |
|
36 | ); |
|
37 | } |
|
38 | ||
39 | /** |
|
40 | * {@inheritDoc} |
|
41 | */ |
|
42 | public function mapField($field, array $input, &$output) |
|
43 | { |
|
44 | $this->guardInvalidArguments($field, $input, $output); |
|
45 | ||
46 | if (!array_key_exists('filesize', $input)) { |
|
47 | return; |
|
48 | } |
|
49 | ||
50 | $filesize = new Filesize($input['filesize']); |
|
51 | ||
52 | $output = $output->withFilesize($filesize); |
|
53 | } |
|
54 | } |
|
55 |
@@ 25-54 (lines=30) @@ | ||
22 | * @category PHPExif |
|
23 | * @package Native |
|
24 | */ |
|
25 | class IsoFieldMapper implements FieldMapper |
|
26 | { |
|
27 | use GuardInvalidArgumentsForExifTrait; |
|
28 | ||
29 | /** |
|
30 | * {@inheritDoc} |
|
31 | */ |
|
32 | public function getSupportedFields() |
|
33 | { |
|
34 | return array( |
|
35 | IsoSpeed::class, |
|
36 | ); |
|
37 | } |
|
38 | ||
39 | /** |
|
40 | * {@inheritDoc} |
|
41 | */ |
|
42 | public function mapField($field, array $input, &$output) |
|
43 | { |
|
44 | $this->guardInvalidArguments($field, $input, $output); |
|
45 | ||
46 | if (!array_key_exists('isospeedratings', $input)) { |
|
47 | return; |
|
48 | } |
|
49 | ||
50 | $iso = new IsoSpeed((int) $input['isospeedratings']); |
|
51 | ||
52 | $output = $output->withIsoSpeed($iso); |
|
53 | } |
|
54 | } |
|
55 |
@@ 25-54 (lines=30) @@ | ||
22 | * @category PHPExif |
|
23 | * @package Native |
|
24 | */ |
|
25 | class MakeFieldMapper implements FieldMapper |
|
26 | { |
|
27 | use GuardInvalidArgumentsForExifTrait; |
|
28 | ||
29 | /** |
|
30 | * {@inheritDoc} |
|
31 | */ |
|
32 | public function getSupportedFields() |
|
33 | { |
|
34 | return array( |
|
35 | Make::class, |
|
36 | ); |
|
37 | } |
|
38 | ||
39 | /** |
|
40 | * {@inheritDoc} |
|
41 | */ |
|
42 | public function mapField($field, array $input, &$output) |
|
43 | { |
|
44 | $this->guardInvalidArguments($field, $input, $output); |
|
45 | ||
46 | if (!array_key_exists('make', $input)) { |
|
47 | return; |
|
48 | } |
|
49 | ||
50 | $make = new Make($input['make']); |
|
51 | ||
52 | $output = $output->withMake($make); |
|
53 | } |
|
54 | } |
|
55 |
@@ 25-54 (lines=30) @@ | ||
22 | * @category PHPExif |
|
23 | * @package Native |
|
24 | */ |
|
25 | class MimeTypeFieldMapper implements FieldMapper |
|
26 | { |
|
27 | use GuardInvalidArgumentsForExifTrait; |
|
28 | ||
29 | /** |
|
30 | * {@inheritDoc} |
|
31 | */ |
|
32 | public function getSupportedFields() |
|
33 | { |
|
34 | return array( |
|
35 | MimeType::class, |
|
36 | ); |
|
37 | } |
|
38 | ||
39 | /** |
|
40 | * {@inheritDoc} |
|
41 | */ |
|
42 | public function mapField($field, array $input, &$output) |
|
43 | { |
|
44 | $this->guardInvalidArguments($field, $input, $output); |
|
45 | ||
46 | if (!array_key_exists('mimetype', $input)) { |
|
47 | return; |
|
48 | } |
|
49 | ||
50 | $mimeType = new MimeType($input['mimetype']); |
|
51 | ||
52 | $output = $output->withMimeType($mimeType); |
|
53 | } |
|
54 | } |
|
55 |
@@ 25-54 (lines=30) @@ | ||
22 | * @category PHPExif |
|
23 | * @package Native |
|
24 | */ |
|
25 | class ModelFieldMapper implements FieldMapper |
|
26 | { |
|
27 | use GuardInvalidArgumentsForExifTrait; |
|
28 | ||
29 | /** |
|
30 | * {@inheritDoc} |
|
31 | */ |
|
32 | public function getSupportedFields() |
|
33 | { |
|
34 | return array( |
|
35 | Model::class, |
|
36 | ); |
|
37 | } |
|
38 | ||
39 | /** |
|
40 | * {@inheritDoc} |
|
41 | */ |
|
42 | public function mapField($field, array $input, &$output) |
|
43 | { |
|
44 | $this->guardInvalidArguments($field, $input, $output); |
|
45 | ||
46 | if (!array_key_exists('model', $input)) { |
|
47 | return; |
|
48 | } |
|
49 | ||
50 | $model = new Model($input['model']); |
|
51 | ||
52 | $output = $output->withModel($model); |
|
53 | } |
|
54 | } |
|
55 |
@@ 25-54 (lines=30) @@ | ||
22 | * @category PHPExif |
|
23 | * @package Native |
|
24 | */ |
|
25 | class SoftwareFieldMapper implements FieldMapper |
|
26 | { |
|
27 | use GuardInvalidArgumentsForExifTrait; |
|
28 | ||
29 | /** |
|
30 | * {@inheritDoc} |
|
31 | */ |
|
32 | public function getSupportedFields() |
|
33 | { |
|
34 | return array( |
|
35 | Software::class, |
|
36 | ); |
|
37 | } |
|
38 | ||
39 | /** |
|
40 | * {@inheritDoc} |
|
41 | */ |
|
42 | public function mapField($field, array $input, &$output) |
|
43 | { |
|
44 | $this->guardInvalidArguments($field, $input, $output); |
|
45 | ||
46 | if (!array_key_exists('software', $input)) { |
|
47 | return; |
|
48 | } |
|
49 | ||
50 | $software = new Software($input['software']); |
|
51 | ||
52 | $output = $output->withSoftware($software); |
|
53 | } |
|
54 | } |
|
55 |