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 |
||
| 7 | class WorkflowHandler |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * @var mixed |
||
| 11 | */ |
||
| 12 | private $config; |
||
| 13 | |||
| 14 | /** |
||
| 15 | * @var mixed |
||
| 16 | */ |
||
| 17 | private $harvest; |
||
| 18 | |||
| 19 | /** |
||
| 20 | * @var mixed |
||
| 21 | */ |
||
| 22 | private $toggl; |
||
| 23 | |||
| 24 | /** |
||
| 25 | * @param Config $config |
||
| 26 | */ |
||
| 27 | public function __construct(Config $config = null) |
||
| 33 | |||
| 34 | /** |
||
| 35 | * @param $projectId |
||
| 36 | * @return mixed |
||
| 37 | */ |
||
| 38 | public function getProjectName($projectId) |
||
| 53 | |||
| 54 | /** |
||
| 55 | * @return mixed |
||
| 56 | */ |
||
| 57 | View Code Duplication | public function getRecentTimers() |
|
| 69 | |||
| 70 | /** |
||
| 71 | * @param $service |
||
| 72 | * @param null $action |
||
| 73 | * @param null $success |
||
| 74 | */ |
||
| 75 | View Code Duplication | public function setNotificationForService($service = null, $action = null, $success = null) |
|
| 83 | |||
| 84 | /** |
||
| 85 | * @return mixed |
||
| 86 | */ |
||
| 87 | View Code Duplication | public function syncOnlineDataToLocalCache() |
|
| 99 | |||
| 100 | /** |
||
| 101 | * @return mixed |
||
| 102 | */ |
||
| 103 | private function getRecentServiceTimers($service) |
||
| 107 | |||
| 108 | /** |
||
| 109 | * @param $data |
||
| 110 | * @param string $service |
||
| 111 | */ |
||
| 112 | private function saveServiceDataCache($service, $data) |
||
| 117 | |||
| 118 | /** |
||
| 119 | * @param $service |
||
| 120 | * @return mixed |
||
| 121 | */ |
||
| 122 | private function syncServiceOnlineDataToLocalCache($service) |
||
| 134 | } |
||
| 135 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.