GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Pull Request — develop (#4)
by Tom Van
03:17
created

ResolutionFieldMapper::getSupportedFields()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 0
1
<?php
2
/**
3
 * Mapper for mapping data between raw input and a HorizontalResolution VO
4
 *
5
 * @link        http://github.com/PHPExif/php-exif-native for the canonical source repository
6
 * @copyright   Copyright (c) 2016 Tom Van Herreweghe <[email protected]>
7
 * @license     http://github.com/PHPExif/php-exif-native/blob/master/LICENSE MIT License
8
 * @category    PHPExif
9
 * @package     Native
10
 */
11
12
namespace PHPExif\Adapter\Native\Reader\Mapper\Exif;
13
14
use PHPExif\Common\Data\ExifInterface;
15
use PHPExif\Common\Data\ValueObject\HorizontalResolution;
16
use PHPExif\Common\Data\ValueObject\VerticalResolution;
17
use PHPExif\Common\Mapper\FieldMapper;
18
19
/**
20
 * Mapper
21
 *
22
 * @category    PHPExif
23
 * @package     Native
24
 */
25
class ResolutionFieldMapper implements FieldMapper
26
{
27
    /**
28
     * @var array
29
     */
30
    protected $map = [
31
        HorizontalResolution::class => [
32
            'dataField' => 'XResolution',
33
            'method' => 'withHorizontalResolution',
34
        ],
35
        VerticalResolution::class => [
36
            'dataField' => 'YResolution',
37
            'method' => 'withVerticalResolution',
38
        ],
39
    ];
40
41
    use GuardInvalidArgumentsTrait;
42
43
    /**
44
     * {@inheritDoc}
45
     */
46
    public function getSupportedFields()
47
    {
48
        return array(
49
            HorizontalResolution::class,
50
            VerticalResolution::class,
51
        );
52
    }
53
54
    /**
55
     * {@inheritDoc}
56
     */
57
    public function mapField($field, array $input, &$output)
58
    {
59
        $this->guardInvalidArguments($field, $input, $output);
60
61
        $inputField = $this->map[$field]['dataField'];
62
63
        if (!array_key_exists($inputField, $input)) {
64
            return;
65
        }
66
67
        $valueObject = new $field(
68
            $input[$inputField]
69
        );
70
71
        $output = $output->{$this->map[$field]['method']}($valueObject);
72
    }
73
}
74