1 | <?php namespace Anomaly\Streams\Platform\Field; |
||
19 | class FieldModel extends EloquentModel implements FieldInterface |
||
20 | { |
||
21 | |||
22 | /** |
||
23 | * Eager loaded relations. |
||
24 | * |
||
25 | * @var array |
||
26 | */ |
||
27 | protected $with = [ |
||
28 | 'translations', |
||
29 | ]; |
||
30 | |||
31 | /** |
||
32 | * Do not use timestamps. |
||
33 | * |
||
34 | * @var bool |
||
35 | */ |
||
36 | public $timestamps = false; |
||
37 | |||
38 | /** |
||
39 | * Default attributes. |
||
40 | * |
||
41 | * @var array |
||
42 | */ |
||
43 | protected $attributes = [ |
||
44 | 'config' => 'a:0:{}', |
||
45 | ]; |
||
46 | |||
47 | /** |
||
48 | * The cache minutes. |
||
49 | * |
||
50 | * @var int |
||
51 | */ |
||
52 | protected $cacheMinutes = 99999; |
||
53 | |||
54 | /** |
||
55 | * The foreign key for translations. |
||
56 | * |
||
57 | * @var string |
||
58 | */ |
||
59 | protected $translationForeignKey = 'field_id'; |
||
60 | |||
61 | /** |
||
62 | * Translatable attributes. |
||
63 | * |
||
64 | * @var array |
||
65 | */ |
||
66 | protected $translatedAttributes = [ |
||
67 | 'name', |
||
68 | 'warning', |
||
69 | 'placeholder', |
||
70 | 'instructions', |
||
71 | ]; |
||
72 | |||
73 | /** |
||
74 | * The translation model. |
||
75 | * |
||
76 | * @var string |
||
77 | */ |
||
78 | protected $translationModel = 'Anomaly\Streams\Platform\Field\FieldModelTranslation'; |
||
79 | |||
80 | /** |
||
81 | * The database table name. |
||
82 | * |
||
83 | * @var string |
||
84 | */ |
||
85 | protected $table = 'streams_fields'; |
||
86 | |||
87 | /** |
||
88 | * The field type builder. |
||
89 | * |
||
90 | * @var FieldTypeBuilder |
||
91 | */ |
||
92 | protected static $builder; |
||
93 | |||
94 | /** |
||
95 | * Boot the model. |
||
96 | */ |
||
97 | protected static function boot() |
||
103 | |||
104 | /** |
||
105 | * Get the ID. |
||
106 | * |
||
107 | * @return mixed |
||
108 | */ |
||
109 | public function getId() |
||
113 | |||
114 | /** |
||
115 | * Get the name. |
||
116 | * |
||
117 | * @param null|string $locale |
||
|
|||
118 | * @return string |
||
119 | */ |
||
120 | public function getName() |
||
124 | |||
125 | /** |
||
126 | * Get the warning. |
||
127 | * |
||
128 | * @return string |
||
129 | */ |
||
130 | public function getWarning() |
||
134 | |||
135 | /** |
||
136 | * Get the instructions. |
||
137 | * |
||
138 | * @return string |
||
139 | */ |
||
140 | public function getInstructions() |
||
144 | |||
145 | /** |
||
146 | * Get the placeholder. |
||
147 | * |
||
148 | * @return string |
||
149 | */ |
||
150 | public function getPlaceholder() |
||
154 | |||
155 | /** |
||
156 | * Get the slug. |
||
157 | * |
||
158 | * @return mixed |
||
159 | */ |
||
160 | public function getSlug() |
||
164 | |||
165 | /** |
||
166 | * Get the stream. |
||
167 | * |
||
168 | * @return string |
||
169 | */ |
||
170 | public function getStream() |
||
174 | |||
175 | /** |
||
176 | * Get the namespace. |
||
177 | * |
||
178 | * @return string |
||
179 | */ |
||
180 | public function getNamespace() |
||
184 | |||
185 | /** |
||
186 | * Get the field type. |
||
187 | * |
||
188 | * @param bool $fresh |
||
189 | * @return FieldType|null |
||
190 | * @throws \Exception |
||
191 | */ |
||
192 | public function getType($fresh = false) |
||
209 | |||
210 | /** |
||
211 | * Get the field type value. |
||
212 | * |
||
213 | * @return string |
||
214 | */ |
||
215 | public function getTypeValue() |
||
219 | |||
220 | /** |
||
221 | * Get the configuration. |
||
222 | * |
||
223 | * @return mixed |
||
224 | */ |
||
225 | public function getConfig() |
||
229 | |||
230 | /** |
||
231 | * Get the related assignments. |
||
232 | * |
||
233 | * @return AssignmentCollection |
||
234 | */ |
||
235 | public function getAssignments() |
||
239 | |||
240 | /** |
||
241 | * Return whether the field |
||
242 | * has assignments or not. |
||
243 | * |
||
244 | * @return bool |
||
245 | */ |
||
246 | public function hasAssignments() |
||
252 | |||
253 | /** |
||
254 | * Return whether the field is |
||
255 | * a relationship or not. |
||
256 | * |
||
257 | * @return bool |
||
258 | */ |
||
259 | public function isRelationship() |
||
263 | |||
264 | /** |
||
265 | * Get the locked flag. |
||
266 | * |
||
267 | * @return mixed |
||
268 | */ |
||
269 | public function isLocked() |
||
273 | |||
274 | /** |
||
275 | * Set config attribute. |
||
276 | * |
||
277 | * @param array $config |
||
278 | */ |
||
279 | public function setConfigAttribute($config) |
||
283 | |||
284 | /** |
||
285 | * Return the decoded config attribute. |
||
286 | * |
||
287 | * @param $config |
||
288 | * @return mixed |
||
289 | */ |
||
290 | public function getConfigAttribute($config) |
||
294 | |||
295 | /** |
||
296 | * Set rules attribute. |
||
297 | * |
||
298 | * @param array $rules |
||
299 | */ |
||
300 | public function setRulesAttribute($rules) |
||
304 | |||
305 | /** |
||
306 | * Return the decoded rules attribute. |
||
307 | * |
||
308 | * @param $rules |
||
309 | * @return mixed |
||
310 | */ |
||
311 | public function getRulesAttribute($rules) |
||
315 | |||
316 | /** |
||
317 | * Set the stream namespace. |
||
318 | * |
||
319 | * @param StreamInterface $stream |
||
320 | */ |
||
321 | public function setStreamAttribute(StreamInterface $stream) |
||
325 | |||
326 | /** |
||
327 | * Compile the fields's stream. |
||
328 | * |
||
329 | * @return FieldInterface |
||
330 | */ |
||
331 | public function compileStreams() |
||
340 | |||
341 | /** |
||
342 | * Return the assignments relation. |
||
343 | * |
||
344 | * @return HasMany |
||
345 | */ |
||
346 | public function assignments() |
||
350 | } |
||
351 |
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italy
is not defined by the methodfinale(...)
.The most likely cause is that the parameter was removed, but the annotation was not.