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 |
||
23 | class BaseMapper extends Mapper { |
||
24 | |||
25 | public function __construct(IDBConnection $db, $tableName, $entityClass=null){ |
||
28 | |||
29 | /** |
||
30 | * Find a single entity by id and user_id |
||
31 | * @param integer $id |
||
32 | * @param string $userId |
||
33 | * @return Entity |
||
34 | */ |
||
35 | public function find($id, $userId){ |
||
39 | |||
40 | /** |
||
41 | * Find all entities matching the given IDs without specifying the user |
||
42 | * @param integer[] $ids IDs of the entities to be found |
||
43 | * @return Entity[] |
||
44 | */ |
||
45 | public function findById($ids){ |
||
50 | |||
51 | /** |
||
52 | * Delete all entities with given IDs without specifying the user |
||
53 | * @param integer[] $ids IDs of the entities to be deleted |
||
54 | */ |
||
55 | public function deleteById($ids){ |
||
63 | |||
64 | /** |
||
65 | * Count all entities of a user |
||
66 | * @param string $userId |
||
67 | */ |
||
68 | View Code Duplication | public function count($userId){ |
|
75 | |||
76 | /** |
||
77 | * Insert an entity, or if an entity with the same identity already exists, |
||
78 | * update the existing entity. |
||
79 | * @param Entity $entity |
||
80 | * @return Entity The inserted or updated entity, containing also the id field |
||
81 | */ |
||
82 | public function insertOrUpdate($entity) { |
||
91 | |||
92 | /** |
||
93 | * helper creating a string like '(?,?,?)' with the specified number of elements |
||
94 | * @param int $count |
||
95 | */ |
||
96 | protected function questionMarks($count) { |
||
103 | |||
104 | } |
||
105 |
Scrutinizer analyzes your
composer.json
/composer.lock
file if available to determine the classes, and functions that are defined by your dependencies.It seems like the listed class was neither found in your dependencies, nor was it found in the analyzed files in your repository. If you are using some other form of dependency management, you might want to disable this analysis.