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

DimensionsFieldMapper::mapField()   B

Complexity

Conditions 4
Paths 4

Size

Total Lines 22
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 22
rs 8.9197
c 0
b 0
f 0
cc 4
eloc 12
nc 4
nop 3
1
<?php
2
/**
3
 * Mapper for mapping data between raw input and a Height 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\Height;
16
use PHPExif\Common\Data\ValueObject\Width;
17
use PHPExif\Common\Mapper\FieldMapper;
18
19
/**
20
 * Mapper
21
 *
22
 * @category    PHPExif
23
 * @package     Native
24
 */
25
class DimensionsFieldMapper implements FieldMapper
26
{
27
    use GuardInvalidArgumentsTrait;
28
29
    /**
30
     * {@inheritDoc}
31
     */
32
    public function getSupportedFields()
33
    {
34
        return array(
35
            Height::class,
36
            Width::class,
37
        );
38
    }
39
40
    /**
41
     * {@inheritDoc}
42
     */
43
    public function mapField($field, array $input, &$output)
44
    {
45
        $this->guardInvalidArguments($field, $input, $output);
46
47
        $inputField = 'Height';
48
        if (Width::class === $field) {
49
            $inputField = 'Width';
50
        }
51
52
        if (!array_key_exists('COMPUTED', $input)
53
            || !array_key_exists($inputField, $input['COMPUTED'])) {
54
            return;
55
        }
56
57
        $valueObject = new $field(
58
            (int) $input['COMPUTED'][$inputField]
59
        );
60
61
        $method = 'with' . $inputField;
62
63
        $output = $output->$method($valueObject);
64
    }
65
}
66