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 |
||
| 25 | class SeenUsersIterator extends UsersIterator {
|
||
| 26 | /** |
||
| 27 | * @var AccountMapper |
||
| 28 | */ |
||
| 29 | private $mapper; |
||
| 30 | /** |
||
| 31 | * @var string class name |
||
| 32 | */ |
||
| 33 | private $backend; |
||
| 34 | |||
| 35 | public function __construct(AccountMapper $mapper, $backend) {
|
||
| 39 | |||
| 40 | public function rewind() {
|
||
| 44 | |||
| 45 | View Code Duplication | public function next() {
|
|
| 53 | } |