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.

ResolutionFieldMapper   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 3
dl 0
loc 33
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getSupportedFields() 0 6 1
A mapField() 0 15 3
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\LineResolution;
16
use PHPExif\Common\Data\ValueObject\Resolution;
17
use PHPExif\Common\Mapper\FieldMapper;
18
use PHPExif\Common\Mapper\GuardInvalidArgumentsForExifTrait;
19
20
/**
21
 * Mapper
22
 *
23
 * @category    PHPExif
24
 * @package     Native
25
 */
26
class ResolutionFieldMapper implements FieldMapper
27
{
28
    use GuardInvalidArgumentsForExifTrait;
29
30
    /**
31
     * {@inheritDoc}
32
     */
33
    public function getSupportedFields()
34
    {
35
        return array(
36
            Resolution::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
        if (!(array_key_exists('xresolution', $input) && array_key_exists('yresolution', $input))) {
48
            return;
49
        }
50
51
        $resolution = new Resolution(
52
            LineResolution::dpi($input['xresolution']), // horizontal
53
            LineResolution::dpi($input['yresolution']) // vertical
54
        );
55
56
        $output = $output->withResolution($resolution);
57
    }
58
}
59