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 |
||
| 40 | class Aspect |
||
| 41 | { |
||
| 42 | |||
| 43 | /** |
||
| 44 | * List of advices (\AppserverIo\Doppelgaenger\Entities\Definitions\Advice) which are defined within |
||
| 45 | * the aspect definition |
||
| 46 | * |
||
| 47 | * @var \AppserverIo\Doppelgaenger\Entities\Lists\TypedList $advices |
||
| 48 | */ |
||
| 49 | protected $advices; |
||
| 50 | |||
| 51 | /** |
||
| 52 | * Name of the aspect |
||
| 53 | * |
||
| 54 | * @var string $name |
||
| 55 | */ |
||
| 56 | protected $name; |
||
| 57 | |||
| 58 | /** |
||
| 59 | * Namespace of this aspect definition |
||
| 60 | * |
||
| 61 | * @var string $namespace |
||
| 62 | */ |
||
| 63 | protected $namespace; |
||
| 64 | |||
| 65 | /** |
||
| 66 | * List of pointcut definitions (\AppserverIo\Doppelgaenger\Entities\Definitions\Pointcut) which are defined within |
||
| 67 | * the code of this aspect |
||
| 68 | * |
||
| 69 | * @var \AppserverIo\Doppelgaenger\Entities\Lists\TypedList $pointcuts |
||
| 70 | */ |
||
| 71 | protected $pointcuts; |
||
| 72 | |||
| 73 | /** |
||
| 74 | * Default constructor |
||
| 75 | */ |
||
| 76 | public function __construct() |
||
| 81 | |||
| 82 | /** |
||
| 83 | * Getter for the $advices property |
||
| 84 | * |
||
| 85 | * @return \AppserverIo\Doppelgaenger\Entities\Lists\TypedList |
||
| 86 | */ |
||
| 87 | public function getAdvices() |
||
| 91 | |||
| 92 | /** |
||
| 93 | * Getter for the $name property |
||
| 94 | * |
||
| 95 | * @return string |
||
| 96 | */ |
||
| 97 | public function getName() |
||
| 101 | |||
| 102 | /** |
||
| 103 | * Getter for the $namespace property |
||
| 104 | * |
||
| 105 | * @return string |
||
| 106 | */ |
||
| 107 | public function getNamespace() |
||
| 111 | |||
| 112 | /** |
||
| 113 | * Getter for the $pointcuts property |
||
| 114 | * |
||
| 115 | * @return \AppserverIo\Doppelgaenger\Entities\Lists\TypedList |
||
| 116 | */ |
||
| 117 | public function getPointcuts() |
||
| 121 | |||
| 122 | /** |
||
| 123 | * Will return the qualified name of a structure |
||
| 124 | * |
||
| 125 | * @return string |
||
| 126 | */ |
||
| 127 | View Code Duplication | public function getQualifiedName() |
|
| 136 | |||
| 137 | /** |
||
| 138 | * Setter for the $name property |
||
| 139 | * |
||
| 140 | * @param string $name Name of the aspect |
||
| 141 | * |
||
| 142 | * @return null |
||
| 143 | */ |
||
| 144 | public function setName($name) |
||
| 148 | |||
| 149 | /** |
||
| 150 | * Setter for the $namespace property |
||
| 151 | * |
||
| 152 | * @param string $namespace Namespace of this aspect definition |
||
| 153 | * |
||
| 154 | * @return null |
||
| 155 | */ |
||
| 156 | public function setNamespace($namespace) |
||
| 160 | } |
||
| 161 |