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 |
||
| 5 | class ReflectionMethod extends ReflectionFunctionAbstract |
||
| 6 | { |
||
| 7 | use Parts\VisibilityTrait; |
||
| 8 | use Parts\StaticTrait; |
||
| 9 | use Parts\AbstractTrait; |
||
| 10 | use Parts\FinalTrait; |
||
| 11 | use Parts\DeclaringClassLikeTrait; |
||
| 12 | |||
| 13 | /** |
||
| 14 | * Checks if the method is a constructor. |
||
| 15 | * |
||
| 16 | * @return bool |
||
| 17 | */ |
||
| 18 | public function isConstructor() |
||
| 22 | |||
| 23 | /** |
||
| 24 | * Checks if the method is a destructor. |
||
| 25 | * |
||
| 26 | * @return bool |
||
| 27 | */ |
||
| 28 | public function isDestructor() |
||
| 32 | |||
| 33 | /** |
||
| 34 | * Returns the methods prototype. |
||
| 35 | * |
||
| 36 | * @throws \ReflectionException If the method does not have a prototype. |
||
| 37 | * |
||
| 38 | * @return ReflectionMethod |
||
| 39 | */ |
||
| 40 | public function getPrototype() |
||
| 71 | |||
| 72 | public function getParent() |
||
| 119 | |||
| 120 | /** |
||
| 121 | * Sets a method to be accessible. |
||
| 122 | * |
||
| 123 | * |
||
| 124 | * @param bool $accessible |
||
| 125 | * |
||
| 126 | * @throws \ReflectionException Always... Can't be implemented. |
||
| 127 | */ |
||
| 128 | public function setAccessible($accessible) |
||
| 132 | } |
||
| 133 |