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

ExifMapper::getSupportedFields()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 6
Ratio 100 %

Importance

Changes 0
Metric Value
dl 6
loc 6
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 0
1
<?php
2
/**
3
 * Mapper for mapping data between raw input and Data classes
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;
13
14
use PHPExif\Common\Data\Exif;
15
use PHPExif\Common\Data\ExifInterface;
16
use PHPExif\Common\Data\MetadataInterface;
17
use PHPExif\Common\Exception\Mapper\UnsupportedFieldException;
18
use PHPExif\Common\Exception\Mapper\UnsupportedOutputException;
19
use PHPExif\Common\Mapper\ArrayMapper;
20
use PHPExif\Common\Mapper\FieldMapper;
21
use PHPExif\Common\Mapper\FieldMapperTrait;
22
23
/**
24
 * ExifMapper
25
 *
26
 * Maps the array of exif data onto the correct
27
 * fields of given Exif object
28
 *
29
 * @category    PHPExif
30
 * @package     Native
31
 */
32 View Code Duplication
class ExifMapper implements ArrayMapper, FieldMapper
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
33
{
34
    use FieldMapperTrait;
35
36
    /**
37
     * {@inheritDoc}
38
     */
39
    public function getSupportedFields()
40
    {
41
        return array(
42
            Exif::class,
43
        );
44
    }
45
46
    /**
47
     * {@inheritDoc}
48
     */
49
    public function mapArray(array $input, &$output)
50
    {
51
        if (!($output instanceof ExifInterface)) {
52
            throw UnsupportedOutputException::forOutput($output);
53
        }
54
55
        $fieldMappers = $this->getFieldMappers();
56
57
        foreach ($fieldMappers as $field => $fieldMapper) {
58
            $fieldMapper->mapField(
59
                $field,
60
                $input,
61
                $output
62
            );
63
        }
64
    }
65
66
    /**
67
     * {@inheritDoc}
68
     */
69
    public function mapField($field, array $input, &$output)
70
    {
71
        if (!in_array($field, $this->getSupportedFields())) {
72
            throw UnsupportedFieldException::forField($field);
73
        }
74
75
        if (!($output instanceof MetadataInterface)) {
76
            throw UnsupportedOutputException::forOutput($output);
77
        }
78
79
        $exif = $output->getExif();
80
        $this->mapArray($input, $exif);
81
        $output = $output->withExif($exif);
82
    }
83
}
84