Completed
Push — master ( fb964a...b7229e )
by Jonathan
9s
created

StaticReflectionClass   B

Complexity

Total Complexity 50

Size/Duplication

Total Lines 404
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 404
rs 8.6206
c 0
b 0
f 0
ccs 101
cts 101
cp 1
wmc 50

50 Methods

Rating   Name   Duplication   Size   Complexity  
A getModifiers() 0 3 1
A getProperties() 0 3 1
A isInterface() 0 3 1
A isFinal() 0 3 1
A getInterfaces() 0 3 1
A isInstance() 0 3 1
A isInstantiable() 0 3 1
A isCloneable() 0 3 1
A isUserDefined() 0 3 1
A isIterateable() 0 3 1
A setStaticPropertyValue() 0 3 1
A getName() 0 3 1
A getConstants() 0 3 1
A inNamespace() 0 3 1
A __construct() 0 3 1
A hasProperty() 0 3 1
A getMethods() 0 3 1
A getParentClass() 0 3 1
A export() 0 3 1
A getDocComment() 0 3 1
A hasConstant() 0 3 1
A getInterfaceNames() 0 3 1
A getTraits() 0 3 1
A getProperty() 0 3 1
A newInstanceArgs() 0 3 1
A getDefaultProperties() 0 3 1
A isInternal() 0 3 1
A isSubclassOf() 0 3 1
A getUseStatements() 0 3 1
A getStartLine() 0 3 1
A getTraitAliases() 0 3 1
A getEndLine() 0 3 1
A getExtension() 0 3 1
A getMethod() 0 3 1
A __toString() 0 3 1
A isAbstract() 0 3 1
A implementsInterface() 0 3 1
A getShortName() 0 3 1
A getTraitNames() 0 3 1
A getStaticProperties() 0 3 1
A isTrait() 0 3 1
A getFileName() 0 3 1
A getConstant() 0 3 1
A getConstructor() 0 3 1
A getExtensionName() 0 3 1
A getNamespaceName() 0 3 1
A getStaticPropertyValue() 0 3 1
A hasMethod() 0 3 1
A newInstanceWithoutConstructor() 0 3 1
A newInstance() 0 3 1

How to fix   Complexity   

Complex Class

Complex classes like StaticReflectionClass often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes.

Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.

While breaking up the class, it is a good idea to analyze how other classes use StaticReflectionClass, and based on these observations, apply Extract Interface, too.

1
<?php
2
3
namespace Doctrine\Common\Reflection;
4
5
use ReflectionClass;
6
use ReflectionException;
7
8
class StaticReflectionClass extends ReflectionClass
9
{
10
    /**
11
     * The static reflection parser object.
12
     *
13
     * @var StaticReflectionParser
14
     */
15
    private $staticReflectionParser;
16
17 49
    public function __construct(StaticReflectionParser $staticReflectionParser)
18
    {
19 49
        $this->staticReflectionParser = $staticReflectionParser;
20 49
    }
21
22
    /**
23
     * {@inheritDoc}
24
     */
25 1
    public function getName()
26
    {
27 1
        return $this->staticReflectionParser->getClassName();
28
    }
29
30
    /**
31
     * {@inheritDoc}
32
     */
33 1
    public function getDocComment()
34
    {
35 1
        return $this->staticReflectionParser->getDocComment();
36
    }
37
38
    /**
39
     * {@inheritDoc}
40
     */
41 1
    public function getNamespaceName()
42
    {
43 1
        return $this->staticReflectionParser->getNamespaceName();
44
    }
45
46
    /**
47
     * @return string[]
48
     */
49 1
    public function getUseStatements()
50
    {
51 1
        return $this->staticReflectionParser->getUseStatements();
52
    }
53
54
    /**
55
     * {@inheritDoc}
56
     */
57 1
    public function getMethod($name)
58
    {
59 1
        return $this->staticReflectionParser->getReflectionMethod($name);
60
    }
61
62
    /**
63
     * {@inheritDoc}
64
     */
65 1
    public function getProperty($name)
66
    {
67 1
        return $this->staticReflectionParser->getReflectionProperty($name);
68
    }
69
70
    /**
71
     * {@inheritDoc}
72
     */
73 1
    public static function export($argument, $return = false)
74
    {
75 1
        throw new ReflectionException('Method not implemented');
76
    }
77
78
    /**
79
     * {@inheritDoc}
80
     */
81 1
    public function getConstant($name)
82
    {
83 1
        throw new ReflectionException('Method not implemented');
84
    }
85
86
    /**
87
     * {@inheritDoc}
88
     */
89 1
    public function getConstants()
90
    {
91 1
        throw new ReflectionException('Method not implemented');
92
    }
93
94
    /**
95
     * {@inheritDoc}
96
     */
97 1
    public function getConstructor()
98
    {
99 1
        throw new ReflectionException('Method not implemented');
100
    }
101
102
    /**
103
     * {@inheritDoc}
104
     */
105 1
    public function getDefaultProperties()
106
    {
107 1
        throw new ReflectionException('Method not implemented');
108
    }
109
110
    /**
111
     * {@inheritDoc}
112
     */
113 1
    public function getEndLine()
114
    {
115 1
        throw new ReflectionException('Method not implemented');
116
    }
117
118
    /**
119
     * {@inheritDoc}
120
     */
121 1
    public function getExtension()
122
    {
123 1
        throw new ReflectionException('Method not implemented');
124
    }
125
126
    /**
127
     * {@inheritDoc}
128
     */
129 1
    public function getExtensionName()
130
    {
131 1
        throw new ReflectionException('Method not implemented');
132
    }
133
134
    /**
135
     * {@inheritDoc}
136
     */
137 1
    public function getFileName()
138
    {
139 1
        throw new ReflectionException('Method not implemented');
140
    }
141
142
    /**
143
     * {@inheritDoc}
144
     */
145 1
    public function getInterfaceNames()
146
    {
147 1
        throw new ReflectionException('Method not implemented');
148
    }
149
150
    /**
151
     * {@inheritDoc}
152
     */
153 1
    public function getInterfaces()
154
    {
155 1
        throw new ReflectionException('Method not implemented');
156
    }
157
158
    /**
159
     * {@inheritDoc}
160
     */
161 1
    public function getMethods($filter = null)
162
    {
163 1
        throw new ReflectionException('Method not implemented');
164
    }
165
166
    /**
167
     * {@inheritDoc}
168
     */
169 1
    public function getModifiers()
170
    {
171 1
        throw new ReflectionException('Method not implemented');
172
    }
173
174
    /**
175
     * {@inheritDoc}
176
     */
177 1
    public function getParentClass()
178
    {
179 1
        throw new ReflectionException('Method not implemented');
180
    }
181
182
    /**
183
     * {@inheritDoc}
184
     */
185 1
    public function getProperties($filter = null)
186
    {
187 1
        throw new ReflectionException('Method not implemented');
188
    }
189
190
    /**
191
     * {@inheritDoc}
192
     */
193 1
    public function getShortName()
194
    {
195 1
        throw new ReflectionException('Method not implemented');
196
    }
197
198
    /**
199
     * {@inheritDoc}
200
     */
201 1
    public function getStartLine()
202
    {
203 1
        throw new ReflectionException('Method not implemented');
204
    }
205
206
    /**
207
     * {@inheritDoc}
208
     */
209 1
    public function getStaticProperties()
210
    {
211 1
        throw new ReflectionException('Method not implemented');
212
    }
213
214
    /**
215
     * {@inheritDoc}
216
     */
217 1
    public function getStaticPropertyValue($name, $default = '')
218
    {
219 1
        throw new ReflectionException('Method not implemented');
220
    }
221
222
    /**
223
     * {@inheritDoc}
224
     */
225 1
    public function getTraitAliases()
226
    {
227 1
        throw new ReflectionException('Method not implemented');
228
    }
229
230
    /**
231
     * {@inheritDoc}
232
     */
233 1
    public function getTraitNames()
234
    {
235 1
        throw new ReflectionException('Method not implemented');
236
    }
237
238
    /**
239
     * {@inheritDoc}
240
     */
241 1
    public function getTraits()
242
    {
243 1
        throw new ReflectionException('Method not implemented');
244
    }
245
246
    /**
247
     * {@inheritDoc}
248
     */
249 1
    public function hasConstant($name)
250
    {
251 1
        throw new ReflectionException('Method not implemented');
252
    }
253
254
    /**
255
     * {@inheritDoc}
256
     */
257 1
    public function hasMethod($name)
258
    {
259 1
        throw new ReflectionException('Method not implemented');
260
    }
261
262
    /**
263
     * {@inheritDoc}
264
     */
265 1
    public function hasProperty($name)
266
    {
267 1
        throw new ReflectionException('Method not implemented');
268
    }
269
270
    /**
271
     * {@inheritDoc}
272
     */
273 1
    public function implementsInterface($interface)
274
    {
275 1
        throw new ReflectionException('Method not implemented');
276
    }
277
278
    /**
279
     * {@inheritDoc}
280
     */
281 1
    public function inNamespace()
282
    {
283 1
        throw new ReflectionException('Method not implemented');
284
    }
285
286
    /**
287
     * {@inheritDoc}
288
     */
289 1
    public function isAbstract()
290
    {
291 1
        throw new ReflectionException('Method not implemented');
292
    }
293
294
    /**
295
     * {@inheritDoc}
296
     */
297 1
    public function isCloneable()
298
    {
299 1
        throw new ReflectionException('Method not implemented');
300
    }
301
302
    /**
303
     * {@inheritDoc}
304
     */
305 1
    public function isFinal()
306
    {
307 1
        throw new ReflectionException('Method not implemented');
308
    }
309
310
    /**
311
     * {@inheritDoc}
312
     */
313 1
    public function isInstance($object)
314
    {
315 1
        throw new ReflectionException('Method not implemented');
316
    }
317
318
    /**
319
     * {@inheritDoc}
320
     */
321 1
    public function isInstantiable()
322
    {
323 1
        throw new ReflectionException('Method not implemented');
324
    }
325
326
    /**
327
     * {@inheritDoc}
328
     */
329 1
    public function isInterface()
330
    {
331 1
        throw new ReflectionException('Method not implemented');
332
    }
333
334
    /**
335
     * {@inheritDoc}
336
     */
337 1
    public function isInternal()
338
    {
339 1
        throw new ReflectionException('Method not implemented');
340
    }
341
342
    /**
343
     * {@inheritDoc}
344
     */
345 1
    public function isIterateable()
346
    {
347 1
        throw new ReflectionException('Method not implemented');
348
    }
349
350
    /**
351
     * {@inheritDoc}
352
     */
353 1
    public function isSubclassOf($class)
354
    {
355 1
        throw new ReflectionException('Method not implemented');
356
    }
357
358
    /**
359
     * {@inheritDoc}
360
     */
361 1
    public function isTrait()
362
    {
363 1
        throw new ReflectionException('Method not implemented');
364
    }
365
366
    /**
367
     * {@inheritDoc}
368
     */
369 1
    public function isUserDefined()
370
    {
371 1
        throw new ReflectionException('Method not implemented');
372
    }
373
374
    /**
375
     * {@inheritDoc}
376
     */
377 1
    public function newInstance($args)
378
    {
379 1
        throw new ReflectionException('Method not implemented');
380
    }
381
382
    /**
383
     * {@inheritDoc}
384
     */
385 1
    public function newInstanceArgs(array $args = [])
386
    {
387 1
        throw new ReflectionException('Method not implemented');
388
    }
389
390
    /**
391
     * {@inheritDoc}
392
     */
393 1
    public function newInstanceWithoutConstructor()
394
    {
395 1
        throw new ReflectionException('Method not implemented');
396
    }
397
398
    /**
399
     * {@inheritDoc}
400
     */
401 1
    public function setStaticPropertyValue($name, $value)
402
    {
403 1
        throw new ReflectionException('Method not implemented');
404
    }
405
406
    /**
407
     * {@inheritDoc}
408
     */
409 1
    public function __toString()
410
    {
411 1
        throw new ReflectionException('Method not implemented');
412
    }
413
}
414