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 PageRouter extends AbstractRouter implements RouterInterface { |
||
8 | |||
9 | /* |
||
10 | * (non-PHPdoc) @see \keeko\core\routing\AbstractRouter::__construct() |
||
11 | */ |
||
12 | public function __construct(array $options) { |
||
23 | |||
24 | |||
25 | /* |
||
26 | * (non-PHPdoc) @see \keeko\core\routing\RouteMatcherInterface::match() |
||
27 | */ |
||
28 | View Code Duplication | public function match($destination) { |
|
53 | |||
54 | /* |
||
55 | * @TODO: More data params (e.g. page) (non-PHPdoc) @see \keeko\core\routing\RouteGeneratorInterface::match() |
||
56 | */ |
||
57 | public function generate($data) { |
||
68 | } |
This check looks for function calls that miss required arguments.