Conditions | 5 |
Paths | 8 |
Total Lines | 24 |
Code Lines | 16 |
Lines | 17 |
Ratio | 70.83 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
47 | public function get($propName, Specification $spec = null) |
||
48 | { |
||
49 | if ($spec === null) { |
||
50 | $spec = new Specification('private', 2, false); |
||
51 | } |
||
52 | View Code Duplication | if (array_key_exists($propName, $this->map)) { |
|
53 | $prop = $this->map[$propName]; |
||
54 | if ($spec->satisfy($prop)) { |
||
55 | return $prop; |
||
56 | } |
||
57 | return null; |
||
58 | } |
||
59 | $parent = $this->class->getParent(); |
||
60 | View Code Duplication | if ($parent instanceof ClassData) { |
|
61 | return $parent->properties->get( |
||
62 | $propName, |
||
63 | new Specification( |
||
64 | $spec->getParentMode(), |
||
65 | $spec->isStatic(), |
||
66 | $spec->isMagic() |
||
67 | ) |
||
68 | ); |
||
69 | } |
||
70 | } |
||
71 | |||
76 |
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.