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
Push — develop ( a8c5e8...9b3cdc )
by Tom Van
25s
created

GuardInvalidArgumentsForExifTrait   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 32
Duplicated Lines 93.75 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A guardInvalidArguments() 10 10 3
getSupportedFields() 0 1 ?

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
 * Trait with method to validate arguments of ::mapField
4
 * from Exif\*Mapper classes
5
 *
6
 * @link        http://github.com/PHPExif/php-exif-common for the canonical source repository
7
 * @copyright   Copyright (c) 2016 Tom Van Herreweghe <[email protected]>
8
 * @license     http://github.com/PHPExif/php-exif-common/blob/master/LICENSE MIT License
9
 * @category    PHPExif
10
 * @package     Common
11
 */
12
13
namespace PHPExif\Common\Mapper;
14
15
use PHPExif\Common\Data\ExifInterface;
16
use PHPExif\Common\Exception\Mapper\UnsupportedFieldException;
17
use PHPExif\Common\Exception\Mapper\UnsupportedOutputException;
18
19
/**
20
 * Common method to check the arguments of an Exif\* mapper
21
 *
22
 * @category    PHPExif
23
 * @package     Common
24
 */
25 View Code Duplication
trait GuardInvalidArgumentsForExifTrait
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
    /**
28
     * Guard function for invalid arguments
29
     *
30
     * @codeCoverageIgnore
31
     *
32
     * @param string $field
33
     * @param array $input
34
     * @param object $output
35
     *
36
     * @throws UnsupportedFieldException when asked to map an unsupported field
37
     * @throws UnsupportedOutputException when asked to map data on an unsupported output object
38
     *
39
     * @return void
40
     */
41
    private function guardInvalidArguments($field, array $input, $output)
0 ignored issues
show
Unused Code introduced by
This method is not used, and could be removed.
Loading history...
Unused Code introduced by
The parameter $input is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
42
    {
43
        if (!in_array($field, $this->getSupportedFields())) {
44
            throw UnsupportedFieldException::forField($field);
45
        }
46
47
        if (!($output instanceof ExifInterface)) {
48
            throw UnsupportedOutputException::forOutput($output);
49
        }
50
    }
51
52
    /**
53
     * {@inheritDoc}
54
     */
55
    abstract public function getSupportedFields();
56
}
57