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 |
||
14 | abstract class AbstractCanvasSearchDomain extends AbstractSearchDomain |
||
15 | { |
||
16 | use RequireCanvasPestParameter; |
||
17 | |||
18 | /** |
||
19 | * Canvas ID or SIS ID of the Canvas object |
||
20 | * @var string|integer |
||
21 | */ |
||
22 | protected $id; |
||
23 | |||
24 | /** |
||
25 | * Construct a CanvasSearchDomain from `$params`, requires `id` and `api` |
||
26 | * params, will extract `url` param from `api`, if necessary. |
||
27 | * |
||
28 | * @inheritdoc |
||
29 | * |
||
30 | * @param mixed[string] $params |
||
1 ignored issue
–
show
|
|||
31 | */ |
||
32 | public function __construct($params) |
||
45 | |||
46 | /** |
||
47 | * Update the ID of the Canvas object |
||
48 | * |
||
49 | * @used-by AbstractCanvasSearchDomain::__construct() |
||
50 | * @param string|integer $id Canvas ID or SIS ID formatted as `sis_*_id:*` |
||
51 | */ |
||
52 | protected function setId($id) |
||
61 | |||
62 | /** |
||
63 | * Get the Canvas object ID |
||
64 | * |
||
65 | * @return string|integer |
||
66 | */ |
||
67 | public function getId() |
||
71 | } |
||
72 |
This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.