| @@ 24-56 (lines=33) @@ | ||
| 21 | * @category PHPExif |
|
| 22 | * @package Native |
|
| 23 | */ |
|
| 24 | class ApertureFieldMapper implements FieldMapper |
|
| 25 | { |
|
| 26 | use GuardInvalidArgumentsTrait; |
|
| 27 | ||
| 28 | /** |
|
| 29 | * {@inheritDoc} |
|
| 30 | */ |
|
| 31 | public function getSupportedFields() |
|
| 32 | { |
|
| 33 | return array( |
|
| 34 | Aperture::class, |
|
| 35 | ); |
|
| 36 | } |
|
| 37 | ||
| 38 | /** |
|
| 39 | * {@inheritDoc} |
|
| 40 | */ |
|
| 41 | public function mapField($field, array $input, &$output) |
|
| 42 | { |
|
| 43 | $this->guardInvalidArguments($field, $input, $output); |
|
| 44 | ||
| 45 | if (!array_key_exists('COMPUTED', $input) |
|
| 46 | || !array_key_exists('ApertureFNumber', $input['COMPUTED'])) { |
|
| 47 | return; |
|
| 48 | } |
|
| 49 | ||
| 50 | $aperture = Aperture::fromFocalLength( |
|
| 51 | $input['COMPUTED']['ApertureFNumber'] |
|
| 52 | ); |
|
| 53 | ||
| 54 | $output = $output->withAperture($aperture); |
|
| 55 | } |
|
| 56 | } |
|
| 57 | ||
| @@ 24-56 (lines=33) @@ | ||
| 21 | * @category PHPExif |
|
| 22 | * @package Native |
|
| 23 | */ |
|
| 24 | class HeightFieldMapper implements FieldMapper |
|
| 25 | { |
|
| 26 | use GuardInvalidArgumentsTrait; |
|
| 27 | ||
| 28 | /** |
|
| 29 | * {@inheritDoc} |
|
| 30 | */ |
|
| 31 | public function getSupportedFields() |
|
| 32 | { |
|
| 33 | return array( |
|
| 34 | Height::class, |
|
| 35 | ); |
|
| 36 | } |
|
| 37 | ||
| 38 | /** |
|
| 39 | * {@inheritDoc} |
|
| 40 | */ |
|
| 41 | public function mapField($field, array $input, &$output) |
|
| 42 | { |
|
| 43 | $this->guardInvalidArguments($field, $input, $output); |
|
| 44 | ||
| 45 | if (!array_key_exists('COMPUTED', $input) |
|
| 46 | || !array_key_exists('Height', $input['COMPUTED'])) { |
|
| 47 | return; |
|
| 48 | } |
|
| 49 | ||
| 50 | $height = new Height( |
|
| 51 | (int) $input['COMPUTED']['Height'] |
|
| 52 | ); |
|
| 53 | ||
| 54 | $output = $output->withHeight($height); |
|
| 55 | } |
|
| 56 | } |
|
| 57 | ||
| @@ 24-56 (lines=33) @@ | ||
| 21 | * @category PHPExif |
|
| 22 | * @package Native |
|
| 23 | */ |
|
| 24 | class WidthFieldMapper implements FieldMapper |
|
| 25 | { |
|
| 26 | use GuardInvalidArgumentsTrait; |
|
| 27 | ||
| 28 | /** |
|
| 29 | * {@inheritDoc} |
|
| 30 | */ |
|
| 31 | public function getSupportedFields() |
|
| 32 | { |
|
| 33 | return array( |
|
| 34 | Width::class, |
|
| 35 | ); |
|
| 36 | } |
|
| 37 | ||
| 38 | /** |
|
| 39 | * {@inheritDoc} |
|
| 40 | */ |
|
| 41 | public function mapField($field, array $input, &$output) |
|
| 42 | { |
|
| 43 | $this->guardInvalidArguments($field, $input, $output); |
|
| 44 | ||
| 45 | if (!array_key_exists('COMPUTED', $input) |
|
| 46 | || !array_key_exists('Width', $input['COMPUTED'])) { |
|
| 47 | return; |
|
| 48 | } |
|
| 49 | ||
| 50 | $width = new Width( |
|
| 51 | (int) $input['COMPUTED']['Width'] |
|
| 52 | ); |
|
| 53 | ||
| 54 | $output = $output->withWidth($width); |
|
| 55 | } |
|
| 56 | } |
|
| 57 | ||