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.

DimensionsFieldMapper::mapField()   A
last analyzed

Complexity

Conditions 4
Paths 3

Size

Total Lines 20
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 20
rs 9.2
c 0
b 0
f 0
cc 4
eloc 11
nc 3
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\Dimensions;
16
use PHPExif\Common\Data\ValueObject\Height;
17
use PHPExif\Common\Data\ValueObject\Width;
18
use PHPExif\Common\Mapper\FieldMapper;
19
use PHPExif\Common\Mapper\GuardInvalidArgumentsForExifTrait;
20
21
/**
22
 * Mapper
23
 *
24
 * @category    PHPExif
25
 * @package     Native
26
 */
27
class DimensionsFieldMapper implements FieldMapper
28
{
29
    use GuardInvalidArgumentsForExifTrait;
30
31
    /**
32
     * {@inheritDoc}
33
     */
34
    public function getSupportedFields()
35
    {
36
        return array(
37
            Dimensions::class,
38
        );
39
    }
40
41
    /**
42
     * {@inheritDoc}
43
     */
44
    public function mapField($field, array $input, &$output)
45
    {
46
        $this->guardInvalidArguments($field, $input, $output);
47
48
        if (!array_key_exists('computed', $input)) {
49
            return;
50
        }
51
        $input = $input['computed'];
52
53
        if (!(array_key_exists('width', $input) && array_key_exists('height', $input))) {
54
            return;
55
        }
56
57
        $dimensions = new Dimensions(
58
            Width::pixels((int) $input['width']),
59
            Height::pixels((int) $input['height'])
60
        );
61
62
        $output = $output->withDimensions($dimensions);
63
    }
64
}
65