@@ 25-57 (lines=33) @@ | ||
22 | * @category PHPExif |
|
23 | * @package Native |
|
24 | */ |
|
25 | class ApertureFieldMapper implements FieldMapper |
|
26 | { |
|
27 | use GuardInvalidArgumentsForExifTrait; |
|
28 | ||
29 | /** |
|
30 | * {@inheritDoc} |
|
31 | */ |
|
32 | public function getSupportedFields() |
|
33 | { |
|
34 | return array( |
|
35 | Aperture::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('computed', $input) |
|
47 | || !array_key_exists('aperturefnumber', $input['computed'])) { |
|
48 | return; |
|
49 | } |
|
50 | ||
51 | $aperture = Aperture::fromFocalLength( |
|
52 | $input['computed']['aperturefnumber'] |
|
53 | ); |
|
54 | ||
55 | $output = $output->withAperture($aperture); |
|
56 | } |
|
57 | } |
|
58 |
@@ 25-57 (lines=33) @@ | ||
22 | * @category PHPExif |
|
23 | * @package Native |
|
24 | */ |
|
25 | class FocusDistanceFieldMapper implements FieldMapper |
|
26 | { |
|
27 | use GuardInvalidArgumentsForExifTrait; |
|
28 | ||
29 | /** |
|
30 | * {@inheritDoc} |
|
31 | */ |
|
32 | public function getSupportedFields() |
|
33 | { |
|
34 | return array( |
|
35 | FocusDistance::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('computed', $input) |
|
47 | || !array_key_exists('focusdistance', $input['computed'])) { |
|
48 | return; |
|
49 | } |
|
50 | ||
51 | $focusDistance = new FocusDistance( |
|
52 | $input['computed']['focusdistance'] |
|
53 | ); |
|
54 | ||
55 | $output = $output->withFocusDistance($focusDistance); |
|
56 | } |
|
57 | } |
|
58 |