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 |
||
| 11 | class PoolDecorator extends BasePoolDecorator |
||
| 12 | { |
||
| 13 | /** @var CacheItemPoolInterface */ |
||
| 14 | private $decorated; |
||
|
|
|||
| 15 | /** @var PasswordInterface */ |
||
| 16 | private $password; |
||
| 17 | /** @var string */ |
||
| 18 | private $cipher; |
||
| 19 | |||
| 20 | 426 | View Code Duplication | public function __construct( |
| 37 | |||
| 38 | 126 | protected function decorate(CacheItemInterface $inner) |
|
| 46 | |||
| 47 | 75 | public function save(CacheItemInterface $item) |
|
| 52 | |||
| 53 | 42 | public function saveDeferred(CacheItemInterface $item) |
|
| 58 | |||
| 59 | 117 | private function finalizeItem(CacheItemInterface $item) |
|
| 68 | } |
||
| 69 |