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 |
||
| 19 | abstract class AbstractContentSlot extends AbstractSlot |
||
| 20 | { |
||
| 21 | /** |
||
| 22 | * Purges relevant HTTP cache for $signal. |
||
| 23 | * |
||
| 24 | * @param \eZ\Publish\Core\SignalSlot\Signal $signal |
||
| 25 | * |
||
| 26 | * @return mixed |
||
| 27 | */ |
||
| 28 | protected function purgeHttpCache(Signal $signal) |
||
| 32 | |||
| 33 | /** |
||
| 34 | * Default provides tags to clear content, relation, location, parent and sibling cache. |
||
| 35 | * |
||
| 36 | * Overload for tree operations where you also need to clear whole path. |
||
| 37 | * |
||
| 38 | * @param \eZ\Publish\Core\SignalSlot\Signal $signal |
||
| 39 | * |
||
| 40 | * @return array |
||
| 41 | */ |
||
| 42 | protected function generateTags(Signal $signal) |
||
| 69 | } |
||
| 70 |
Since your code implements the magic getter
_get, this function will be called for any read access on an undefined variable. You can add the@propertyannotation to your class or interface to document the existence of this variable.If the property has read access only, you can use the @property-read annotation instead.
Of course, you may also just have mistyped another name, in which case you should fix the error.
See also the PhpDoc documentation for @property.