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 | class Audiences |
||
15 | { |
||
16 | /** |
||
17 | * Optimizely API Client. |
||
18 | * @var WebMarketingROI\OptimizelyPHP\OptimizelyApiClient |
||
19 | */ |
||
20 | private $client; |
||
21 | |||
22 | /** |
||
23 | * Constructor. |
||
24 | */ |
||
25 | 4 | public function __construct($client) |
|
29 | |||
30 | /** |
||
31 | * List Audiences for a Project |
||
32 | * @param integer $projectId |
||
33 | * @param integer $page |
||
34 | * @param integer $perPage |
||
35 | * @return array[Audience] |
||
|
|||
36 | * @throws \Exception |
||
37 | */ |
||
38 | 1 | View Code Duplication | public function listAll($projectId, $page=0, $perPage=10) |
63 | |||
64 | /** |
||
65 | * Get metadata for a single Audience. |
||
66 | * @param type $audienceId |
||
67 | * @return Audience |
||
68 | * @throws \Exception |
||
69 | */ |
||
70 | 1 | View Code Duplication | public function get($audienceId) |
82 | |||
83 | /** |
||
84 | * Create an Audience for a Project. |
||
85 | * @param Audience $audience |
||
86 | */ |
||
87 | 1 | public function create($audience) |
|
100 | |||
101 | /** |
||
102 | * Update an Audience for a Project |
||
103 | * @param integer $audienceId |
||
104 | * @param Audience $audience |
||
105 | * @throws \Exception |
||
106 | */ |
||
107 | 1 | public function update($audienceId, $audience) |
|
120 | } |
||
121 | |||
126 |
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.