Completed
Pull Request — develop (#2)
by Tom Van
03:07
created

ApertureFieldMapper::mapField()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 14
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 14
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 7
nc 2
nop 3
1
<?php
2
/**
3
 * Mapper for mapping data between raw input and an Aperture VO
4
 *
5
 * @category    PHPExif
6
 * @copyright   Copyright (c) 2016 Tom Van Herreweghe <[email protected]>
7
 * @license     http://github.com/PHPExif/php-exif-exiftool/blob/master/LICENSE MIT License
8
 * @link        http://github.com/PHPExif/php-exif-exiftool for the canonical source repository
9
 * @package     Exiftool
10
 */
11
12
namespace PHPExif\Adapter\Exiftool\Reader\Mapper\Exif;
13
14
use PHPExif\Common\Data\ExifInterface;
15
use PHPExif\Common\Data\ValueObject\Aperture;
16
use PHPExif\Common\Mapper\FieldMapper;
17
use PHPExif\Common\Mapper\GuardInvalidArgumentsForExifTrait;
18
19
/**
20
 * Mapper
21
 *
22
 * @category    PHPExif
23
 * @package     Common
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('composite:aperture', $input)) {
47
            return;
48
        }
49
50
        $aperture = new Aperture(
51
            $input['composite:aperture']
52
        );
53
54
        $output = $output->withAperture($aperture);
55
    }
56
}
57