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.

ModelFieldMapper   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 30
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 2
dl 30
loc 30
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getSupportedFields() 6 6 1
A mapField() 12 12 2

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
/**
3
 * Mapper for mapping data between raw input and a Model 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\Model;
16
use PHPExif\Common\Mapper\FieldMapper;
17
use PHPExif\Common\Mapper\GuardInvalidArgumentsForExifTrait;
18
19
/**
20
 * Mapper
21
 *
22
 * @category    PHPExif
23
 * @package     Native
24
 */
25 View Code Duplication
class ModelFieldMapper implements 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...
26
{
27
    use GuardInvalidArgumentsForExifTrait;
28
29
    /**
30
     * {@inheritDoc}
31
     */
32
    public function getSupportedFields()
33
    {
34
        return array(
35
            Model::class,
36
        );
37
    }
38
39
    /**
40
     * {@inheritDoc}
41
     */
42
    public function mapField($field, array $input, &$output)
43
    {
44
        $this->guardInvalidArguments($field, $input, $output);
45
46
        if (!array_key_exists('model', $input)) {
47
            return;
48
        }
49
50
        $model = new Model($input['model']);
51
52
        $output = $output->withModel($model);
53
    }
54
}
55