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 (#249)
by Théo
34:01
created

Brand   A

Complexity

Total Complexity 34

Size/Duplication

Total Lines 251
Duplicated Lines 6.77 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 34
lcom 1
cbo 1
dl 17
loc 251
rs 9.2
c 0
b 0
f 0

18 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A __get() 5 10 3
A __set() 7 12 3
A __isset() 5 10 3
A __sleep() 0 8 2
A __wakeup() 0 19 4
A __clone() 0 4 2
A __load() 0 4 2
A __isInitialized() 0 4 1
A __setInitialized() 0 4 1
A __setInitializer() 0 4 1
A __getInitializer() 0 4 1
A __setCloner() 0 4 1
A __getCloner() 0 4 1
A __getLazyProperties() 0 4 1
A getId() 0 11 3
A getName() 0 7 2
A getProducts() 0 7 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
namespace Proxies\__CG__\Hautelook\AliceBundle\Tests\SymfonyApp\TestBundle\Entity;
4
5
/**
6
 * DO NOT EDIT THIS FILE - IT WAS CREATED BY DOCTRINE'S PROXY GENERATOR
7
 */
8
class Brand extends \Hautelook\AliceBundle\Tests\SymfonyApp\TestBundle\Entity\Brand implements \Doctrine\ORM\Proxy\Proxy
9
{
10
    /**
11
     * @var \Closure the callback responsible for loading properties in the proxy object. This callback is called with
12
     *      three parameters, being respectively the proxy object to be initialized, the method that triggered the
13
     *      initialization process and an array of ordered parameters that were passed to that method.
14
     *
15
     * @see \Doctrine\Common\Persistence\Proxy::__setInitializer
16
     */
17
    public $__initializer__;
18
19
    /**
20
     * @var \Closure the callback responsible of loading properties that need to be copied in the cloned object
21
     *
22
     * @see \Doctrine\Common\Persistence\Proxy::__setCloner
23
     */
24
    public $__cloner__;
25
26
    /**
27
     * @var boolean flag indicating if this object was already initialized
28
     *
29
     * @see \Doctrine\Common\Persistence\Proxy::__isInitialized
30
     */
31
    public $__isInitialized__ = false;
32
33
    /**
34
     * @var array properties to be lazy loaded, with keys being the property
35
     *            names and values being their default values
36
     *
37
     * @see \Doctrine\Common\Persistence\Proxy::__getLazyProperties
38
     */
39
    public static $lazyPropertiesDefaults = ['canonicalName' => NULL];
40
41
42
43
    /**
44
     * @param \Closure $initializer
45
     * @param \Closure $cloner
46
     */
47
    public function __construct($initializer = null, $cloner = null)
48
    {
49
        unset($this->canonicalName);
50
51
        $this->__initializer__ = $initializer;
52
        $this->__cloner__      = $cloner;
53
    }
54
55
    /**
56
     *
57
     * @param string $name
58
     */
59
    public function __get($name)
60
    {
61 View Code Duplication
        if (array_key_exists($name, $this->__getLazyProperties())) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across 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...
62
            $this->__initializer__ && $this->__initializer__->__invoke($this, '__get', [$name]);
63
64
            return $this->$name;
65
        }
66
67
        trigger_error(sprintf('Undefined property: %s::$%s', __CLASS__, $name), E_USER_NOTICE);
68
    }
69
70
    /**
71
     *
72
     * @param string $name
73
     * @param mixed  $value
74
     */
75
    public function __set($name, $value)
76
    {
77 View Code Duplication
        if (array_key_exists($name, $this->__getLazyProperties())) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across 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...
78
            $this->__initializer__ && $this->__initializer__->__invoke($this, '__set', [$name, $value]);
79
80
            $this->$name = $value;
81
82
            return;
83
        }
84
85
        $this->$name = $value;
86
    }
87
88
    /**
89
     *
90
     * @param  string $name
91
     * @return boolean
92
     */
93
    public function __isset($name)
94
    {
95 View Code Duplication
        if (array_key_exists($name, $this->__getLazyProperties())) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across 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...
96
            $this->__initializer__ && $this->__initializer__->__invoke($this, '__isset', [$name]);
97
98
            return isset($this->$name);
99
        }
100
101
        return false;
102
    }
103
104
    /**
105
     *
106
     * @return array
107
     */
108
    public function __sleep()
109
    {
110
        if ($this->__isInitialized__) {
111
            return ['__isInitialized__', 'id', 'name', 'canonicalName', 'products'];
112
        }
113
114
        return ['__isInitialized__', 'id', 'name', 'products'];
115
    }
116
117
    /**
118
     *
119
     */
120
    public function __wakeup()
121
    {
122
        if ( ! $this->__isInitialized__) {
123
            $this->__initializer__ = function (Brand $proxy) {
124
                $proxy->__setInitializer(null);
125
                $proxy->__setCloner(null);
126
127
                $existingProperties = get_object_vars($proxy);
128
129
                foreach ($proxy->__getLazyProperties() as $property => $defaultValue) {
130
                    if ( ! array_key_exists($property, $existingProperties)) {
131
                        $proxy->$property = $defaultValue;
132
                    }
133
                }
134
            };
135
136
            unset($this->canonicalName);
137
        }
138
    }
139
140
    /**
141
     *
142
     */
143
    public function __clone()
144
    {
145
        $this->__cloner__ && $this->__cloner__->__invoke($this, '__clone', []);
146
    }
147
148
    /**
149
     * Forces initialization of the proxy
150
     */
151
    public function __load()
152
    {
153
        $this->__initializer__ && $this->__initializer__->__invoke($this, '__load', []);
154
    }
155
156
    /**
157
     * {@inheritDoc}
158
     * @internal generated method: use only when explicitly handling proxy specific loading logic
159
     */
160
    public function __isInitialized()
161
    {
162
        return $this->__isInitialized__;
163
    }
164
165
    /**
166
     * {@inheritDoc}
167
     * @internal generated method: use only when explicitly handling proxy specific loading logic
168
     */
169
    public function __setInitialized($initialized)
170
    {
171
        $this->__isInitialized__ = $initialized;
172
    }
173
174
    /**
175
     * {@inheritDoc}
176
     * @internal generated method: use only when explicitly handling proxy specific loading logic
177
     */
178
    public function __setInitializer(\Closure $initializer = null)
179
    {
180
        $this->__initializer__ = $initializer;
181
    }
182
183
    /**
184
     * {@inheritDoc}
185
     * @internal generated method: use only when explicitly handling proxy specific loading logic
186
     */
187
    public function __getInitializer()
188
    {
189
        return $this->__initializer__;
190
    }
191
192
    /**
193
     * {@inheritDoc}
194
     * @internal generated method: use only when explicitly handling proxy specific loading logic
195
     */
196
    public function __setCloner(\Closure $cloner = null)
197
    {
198
        $this->__cloner__ = $cloner;
199
    }
200
201
    /**
202
     * {@inheritDoc}
203
     * @internal generated method: use only when explicitly handling proxy specific cloning logic
204
     */
205
    public function __getCloner()
206
    {
207
        return $this->__cloner__;
208
    }
209
210
    /**
211
     * {@inheritDoc}
212
     * @internal generated method: use only when explicitly handling proxy specific loading logic
213
     * @static
214
     */
215
    public function __getLazyProperties()
216
    {
217
        return self::$lazyPropertiesDefaults;
218
    }
219
220
221
    /**
222
     * {@inheritDoc}
223
     */
224
    public function getId()
225
    {
226
        if ($this->__isInitialized__ === false) {
227
            return (int)  parent::getId();
228
        }
229
230
231
        $this->__initializer__ && $this->__initializer__->__invoke($this, 'getId', []);
232
233
        return parent::getId();
234
    }
235
236
    /**
237
     * {@inheritDoc}
238
     */
239
    public function getName()
240
    {
241
242
        $this->__initializer__ && $this->__initializer__->__invoke($this, 'getName', []);
243
244
        return parent::getName();
245
    }
246
247
    /**
248
     * {@inheritDoc}
249
     */
250
    public function getProducts()
251
    {
252
253
        $this->__initializer__ && $this->__initializer__->__invoke($this, 'getProducts', []);
254
255
        return parent::getProducts();
256
    }
257
258
}
259