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 |
||
| 24 | class TaskExecutionRepository extends EntityRepository implements TaskExecutionRepositoryInterface |
||
|
|
|||
| 25 | { |
||
| 26 | /** |
||
| 27 | * {@inheritdoc} |
||
| 28 | */ |
||
| 29 | 9 | public function create(TaskInterface $task, \DateTime $scheduleTime) |
|
| 33 | |||
| 34 | /** |
||
| 35 | * {@inheritdoc} |
||
| 36 | */ |
||
| 37 | 9 | public function save(TaskExecutionInterface $execution) |
|
| 44 | |||
| 45 | /** |
||
| 46 | * {@inheritdoc} |
||
| 47 | */ |
||
| 48 | public function remove(TaskExecutionInterface $execution) |
||
| 55 | |||
| 56 | /** |
||
| 57 | * {@inheritdoc} |
||
| 58 | */ |
||
| 59 | 6 | View Code Duplication | public function findAll($page = 1, $pageSize = null) |
| 72 | |||
| 73 | /** |
||
| 74 | * {@inheritdoc} |
||
| 75 | */ |
||
| 76 | 7 | public function findByStartTime(TaskInterface $task, \DateTime $scheduleTime) |
|
| 91 | |||
| 92 | /** |
||
| 93 | * {@inheritdoc} |
||
| 94 | */ |
||
| 95 | public function findByTask(TaskInterface $task) |
||
| 104 | |||
| 105 | /** |
||
| 106 | * {@inheritdoc} |
||
| 107 | */ |
||
| 108 | 2 | public function findScheduled(\DateTime $dateTime = null) |
|
| 122 | } |
||
| 123 |