We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
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 | trait SpatieTranslatableAdaptor |
||
8 | { |
||
9 | use HasTranslations; |
||
10 | |||
11 | public $locale = false; |
||
12 | |||
13 | /* |
||
14 | |-------------------------------------------------------------------------- |
||
15 | | SPATIE/LARAVEL-TRANSLATABLE OVERWRITES |
||
16 | |-------------------------------------------------------------------------- |
||
17 | */ |
||
18 | |||
19 | /** |
||
20 | * Use the forced locale if present. |
||
21 | * |
||
22 | * @param [type] $key [description] |
||
|
|||
23 | * @return [type] [description] |
||
24 | */ |
||
25 | public function getAttributeValue($key) |
||
35 | |||
36 | /* |
||
37 | |-------------------------------------------------------------------------- |
||
38 | | ELOQUENT OVERWRITES |
||
39 | |-------------------------------------------------------------------------- |
||
40 | */ |
||
41 | |||
42 | /** |
||
43 | * Create translated items as json. |
||
44 | * |
||
45 | * @param array $attributes [description] |
||
46 | */ |
||
47 | public static function create(array $attributes = []) |
||
66 | |||
67 | /** |
||
68 | * Update translated items as json. |
||
69 | * |
||
70 | * @param array $attributes |
||
71 | * @param array $options |
||
72 | * @return bool |
||
73 | */ |
||
74 | public function update(array $attributes = [], array $options = []) |
||
95 | |||
96 | /** |
||
97 | * Get the database entry in the wanted locale. |
||
98 | * |
||
99 | * @param [int] The id of the row in the db to fetch. |
||
100 | * |
||
101 | * @return [Eloquent Collection] The row in the db. |
||
102 | */ |
||
103 | View Code Duplication | public function findOrFail($id) |
|
117 | |||
118 | /** |
||
119 | * Get the database entry in the wanted locale. |
||
120 | * |
||
121 | * @param [int] The id of the row in the db to fetch. |
||
122 | * |
||
123 | * @return [Eloquent Collection] The row in the db. |
||
124 | */ |
||
125 | View Code Duplication | public function find($id) |
|
139 | |||
140 | /* |
||
141 | |-------------------------------------------------------------------------- |
||
142 | | CUSTOM METHODS |
||
143 | |-------------------------------------------------------------------------- |
||
144 | */ |
||
145 | |||
146 | /** |
||
147 | * Check if a model is translatable, by the adapter's standards. |
||
148 | * |
||
149 | * @return bool |
||
150 | */ |
||
151 | public function translationEnabledForModel() |
||
155 | |||
156 | /** |
||
157 | * Get all locales the admin is allowed to use. |
||
158 | * |
||
159 | * @return array |
||
160 | */ |
||
161 | public function getAvailableLocales() |
||
165 | |||
166 | /** |
||
167 | * Set the locale property. Used in normalizeLocale() to force the translation |
||
168 | * to a different language that the one set in app()->getLocale();. |
||
169 | * |
||
170 | * @param string |
||
171 | */ |
||
172 | public function setLocale($locale) |
||
176 | } |
||
177 |
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.