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 — master (#104)
by
unknown
06:19
created

FetchEntity   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 34
Duplicated Lines 35.29 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 85.71%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 5
lcom 0
cbo 0
dl 12
loc 34
ccs 6
cts 7
cp 0.8571
rs 10
c 1
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
B __construct() 12 12 5

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
 * @package: chapi
4
 *
5
 * @author:  sbrueggen
6
 * @since:   2018-03-29
7
 */
8
9
namespace Chapi\Entity\Chronos\JobEntity;
10
11
class FetchEntity
12
{
13
    /**
14
     * @param array|object $jobData
15
     * @throws \InvalidArgumentException
16
     */
17 1 View Code Duplication
    public function __construct($jobData = [])
18
    {
19 1
        if (is_array($jobData) || is_object($jobData)) {
20 1
            foreach ($jobData as $key => $value) {
21 1
                if (property_exists($this, $key)) {
22 1
                    $this->{$key} = $value;
23
                }
24
            }
25
        } else {
26
            throw new \InvalidArgumentException(sprintf('Argument 1 passed to "%s" must be an array or object', __METHOD__));
27
        }
28 1
    }
29
    
30
    /** @var string  */
31
    public $uri = "";
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
32
    
33
    /** @var string  */
34
    public $destPath = '';
35
    
36
    /** @var bool */
37
    public $extract = false;
38
    
39
    /** @var bool  */
40
    public $cache = false;
41
    
42
    /** @var bool  */
43
    public $executable = false;
44
}
45