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 ( d6ef0b...33031e )
by Mohamed
20:31 queued 16:33
created

Base   A

Complexity

Total Complexity 11

Size/Duplication

Total Lines 74
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 82.61%

Importance

Changes 0
Metric Value
wmc 11
lcom 1
cbo 0
dl 0
loc 74
ccs 19
cts 23
cp 0.8261
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A setEntityAttributes() 0 11 3
B getArrayCopy() 0 22 6
A getId() 0 4 1
A setId() 0 6 1
1
<?php
2
3
namespace Neta\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 11
    public function setEntityAttributes(array $attributes)
26
    {
27 11
        foreach ($attributes as $attribute => $value) {
28 11
            $setter = 'set' . ucfirst($attribute);
29 11
            if (method_exists($this, $setter)) {
30 11
                $this->$setter($value);
31
            }
32
        }
33
34 11
        return $this;
35
    }
36
37
    /**
38
     * Gets the attributes of this entity.
39
     *
40
     * @return array
41
     */
42 4
    public function getArrayCopy()
43
    {
44 4
        $array = get_object_vars($this);
45
46 4
        foreach ($array as $key => &$value) {
47 4
            if ($value instanceof Base) {
48 1
                $array[$key] = $value->getArrayCopy();
49 4
            } elseif (is_array($value)) {
50
                foreach ($value as $k => $v) {
51
                    if ($v instanceof Base) {
52 4
                        $value[$k] = $v->getArrayCopy();
53
                    }
54
                }
55
            }
56
        }
57
58
        $array = array_filter($array, function ($value) {
59 4
            return $value !== null;
60 4
        });
61
62 4
        return $array;
63
    }
64
65
    /**
66
     * @return int
67
     */
68
    public function getId()
69
    {
70
        return $this->id;
71
    }
72
73
    /**
74
     * @param int $id
75
     *
76
     * @return Base
77
     */
78 9
    public function setId($id)
79
    {
80 9
        $this->id = $id;
81
82 9
        return $this;
83
    }
84
}
85