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 — master ( 5c8165...9618ad )
by
unknown
62:51 queued 37:54
created

Base::getArrayCopy()   B

Complexity

Conditions 6
Paths 6

Size

Total Lines 17
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 10.5

Importance

Changes 0
Metric Value
dl 0
loc 17
ccs 7
cts 14
cp 0.5
rs 8.8571
c 0
b 0
f 0
cc 6
eloc 10
nc 6
nop 0
crap 10.5
1
<?php
2
3
namespace LeadCommerce\Shopware\SDK\Entity;
4
5
/**
6
 * Class Base
7
 *
8
 * @author Alexander Mahrt <[email protected]>
9
 * @copyright 2016 LeadCommerce <[email protected]>
10
 */
11
class Base
12
{
13
    /**
14
     * @var int
15
     */
16
    protected $id;
17
18
    /**
19
     * Sets the attributes of this entity.
20
     *
21
     * @param array $attributes
22
     *
23
     * @return $this
24
     */
25 5
    public function setEntityAttributes(array $attributes)
26
    {
27 5
        foreach ($attributes as $attribute => $value) {
28 5
            $setter = 'set' . ucfirst($attribute);
29 5
            if (method_exists($this, $setter)) {
30 5
                $this->$setter($value);
31 5
            }
32 5
        }
33
34 5
        return $this;
35
    }
36
37
    /**
38
     * Gets the attributes of this entity.
39
     *
40
     * @return array
41
     */
42 3
    public function getArrayCopy()
43
    {
44 3
        $array = get_object_vars($this);
45
46 3
        foreach ($array as $key => &$value) {
47 3
            if ($value instanceof Base) {
48
                $array[$key] = $value->getArrayCopy();
49 3
            } else if (is_array($value)) {
50
                foreach ($value as $k => $v) {
51
                    if ($v instanceof Base) {
52
                        $value[$k] = $v->getArrayCopy();
53
                    }
54
                }
55
            }
56 3
        }
57 3
        return $array;
58
    }
59
60
    /**
61
     * @return int
62
     */
63
    public function getId()
64
    {
65
        return $this->id;
66
    }
67
68
    /**
69
     * @param int $id
70
     *
71
     * @return Base
72
     */
73
    public function setId($id)
74
    {
75
        $this->id = $id;
76
77
        return $this;
78
    }
79
}
80