1 | <?php |
||
9 | class ImageRepository implements ImageRepositoryInterface |
||
10 | { |
||
11 | public function create(array $attributes): ImageRecord |
||
20 | |||
21 | /** |
||
22 | * Find By Id |
||
23 | * |
||
24 | * @param $id |
||
25 | * @return ImageRecord |
||
26 | */ |
||
27 | public function findById($id): ImageRecord |
||
31 | |||
32 | /** |
||
33 | * Update |
||
34 | * |
||
35 | * @param int|ImageRecord $model |
||
36 | * @param array $attributes |
||
37 | * @return mixed |
||
38 | */ |
||
39 | public function update($model, array $attributes) |
||
46 | |||
47 | /** |
||
48 | * @param $identifier |
||
49 | * @return Image |
||
50 | */ |
||
51 | private function _findRecord($identifier) |
||
62 | |||
63 | /** |
||
64 | * Build Image Record From Image |
||
65 | * |
||
66 | * @param Image $image |
||
67 | * @param bool $refresh |
||
68 | * @return ImageRecord |
||
69 | */ |
||
70 | private function _buildImageRecordFromImage(Image $image, bool $refresh = false) |
||
77 | |||
78 | /** |
||
79 | * Find Existing Relation |
||
80 | * |
||
81 | * Search for existing image, by the existing polymorphic identifiers |
||
82 | * |
||
83 | * @param array $identifiers for polymorphic relationship |
||
84 | * @return ImageRecord |
||
85 | */ |
||
86 | public function findExistingImageable(array $identifiers) |
||
94 | |||
95 | /** |
||
96 | * Delete |
||
97 | * |
||
98 | * @param int|ImageRecord $model |
||
99 | * @return bool |
||
100 | * @throws \Exception |
||
101 | */ |
||
102 | public function delete($model) |
||
108 | } |
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVar
assignment in line 1 and the$higher
assignment in line 2 are dead. The first because$myVar
is never used and the second because$higher
is always overwritten for every possible time line.