1 | <?php namespace Anomaly\Streams\Platform\Field; |
||
20 | class FieldModel extends EloquentModel implements FieldInterface |
||
21 | { |
||
22 | |||
23 | /** |
||
24 | * Do not use timestamps. |
||
25 | * |
||
26 | * @var bool |
||
27 | */ |
||
28 | public $timestamps = false; |
||
29 | |||
30 | /** |
||
31 | * Default attributes. |
||
32 | * |
||
33 | * @var array |
||
34 | */ |
||
35 | protected $attributes = [ |
||
36 | 'config' => 'a:0:{}' |
||
37 | ]; |
||
38 | |||
39 | /** |
||
40 | * The cache minutes. |
||
41 | * |
||
42 | * @var int |
||
43 | */ |
||
44 | protected $cacheMinutes = 99999; |
||
45 | |||
46 | /** |
||
47 | * The foreign key for translations. |
||
48 | * |
||
49 | * @var string |
||
50 | */ |
||
51 | protected $translationForeignKey = 'field_id'; |
||
52 | |||
53 | /** |
||
54 | * Translatable attributes. |
||
55 | * |
||
56 | * @var array |
||
57 | */ |
||
58 | protected $translatedAttributes = [ |
||
59 | 'name', |
||
60 | 'warning', |
||
61 | 'placeholder', |
||
62 | 'instructions' |
||
63 | ]; |
||
64 | |||
65 | /** |
||
66 | * The translation model. |
||
67 | * |
||
68 | * @var string |
||
69 | */ |
||
70 | protected $translationModel = 'Anomaly\Streams\Platform\Field\FieldModelTranslation'; |
||
71 | |||
72 | /** |
||
73 | * The database table name. |
||
74 | * |
||
75 | * @var string |
||
76 | */ |
||
77 | protected $table = 'streams_fields'; |
||
78 | |||
79 | /** |
||
80 | * The field type builder. |
||
81 | * |
||
82 | * @var FieldTypeBuilder |
||
83 | */ |
||
84 | protected static $builder; |
||
85 | |||
86 | /** |
||
87 | * Boot the model. |
||
88 | */ |
||
89 | protected static function boot() |
||
95 | |||
96 | /** |
||
97 | * Get the ID. |
||
98 | * |
||
99 | * @return mixed |
||
100 | */ |
||
101 | public function getId() |
||
105 | |||
106 | /** |
||
107 | * Get the name. |
||
108 | * |
||
109 | * @param null|string $locale |
||
|
|||
110 | * @return string |
||
111 | */ |
||
112 | public function getName() |
||
116 | |||
117 | /** |
||
118 | * Get the warning. |
||
119 | * |
||
120 | * @return string |
||
121 | */ |
||
122 | public function getWarning() |
||
126 | |||
127 | /** |
||
128 | * Get the instructions. |
||
129 | * |
||
130 | * @return string |
||
131 | */ |
||
132 | public function getInstructions() |
||
136 | |||
137 | /** |
||
138 | * Get the placeholder. |
||
139 | * |
||
140 | * @return string |
||
141 | */ |
||
142 | public function getPlaceholder() |
||
146 | |||
147 | /** |
||
148 | * Get the slug. |
||
149 | * |
||
150 | * @return mixed |
||
151 | */ |
||
152 | public function getSlug() |
||
156 | |||
157 | /** |
||
158 | * Get the stream. |
||
159 | * |
||
160 | * @return string |
||
161 | */ |
||
162 | public function getStream() |
||
166 | |||
167 | /** |
||
168 | * Get the namespace. |
||
169 | * |
||
170 | * @return string |
||
171 | */ |
||
172 | public function getNamespace() |
||
176 | |||
177 | /** |
||
178 | * Get the field type. |
||
179 | * |
||
180 | * @param bool $fresh |
||
181 | * @return FieldType|null |
||
182 | * @throws \Exception |
||
183 | */ |
||
184 | public function getType($fresh = false) |
||
201 | |||
202 | /** |
||
203 | * Get the field type value. |
||
204 | * |
||
205 | * @return string |
||
206 | */ |
||
207 | public function getTypeValue() |
||
211 | |||
212 | /** |
||
213 | * Get the configuration. |
||
214 | * |
||
215 | * @return mixed |
||
216 | */ |
||
217 | public function getConfig() |
||
221 | |||
222 | /** |
||
223 | * Get the related assignments. |
||
224 | * |
||
225 | * @return AssignmentCollection |
||
226 | */ |
||
227 | public function getAssignments() |
||
231 | |||
232 | /** |
||
233 | * Return whether the field |
||
234 | * has assignments or not. |
||
235 | * |
||
236 | * @return bool |
||
237 | */ |
||
238 | public function hasAssignments() |
||
244 | |||
245 | /** |
||
246 | * Return whether the field is |
||
247 | * a relationship or not. |
||
248 | * |
||
249 | * @return bool |
||
250 | */ |
||
251 | public function isRelationship() |
||
255 | |||
256 | /** |
||
257 | * Get the locked flag. |
||
258 | * |
||
259 | * @return mixed |
||
260 | */ |
||
261 | public function isLocked() |
||
265 | |||
266 | /** |
||
267 | * Set config attribute. |
||
268 | * |
||
269 | * @param array $config |
||
270 | */ |
||
271 | public function setConfigAttribute($config) |
||
275 | |||
276 | /** |
||
277 | * Return the decoded config attribute. |
||
278 | * |
||
279 | * @param $config |
||
280 | * @return mixed |
||
281 | */ |
||
282 | public function getConfigAttribute($config) |
||
286 | |||
287 | /** |
||
288 | * Set rules attribute. |
||
289 | * |
||
290 | * @param array $rules |
||
291 | */ |
||
292 | public function setRulesAttribute($rules) |
||
296 | |||
297 | /** |
||
298 | * Return the decoded rules attribute. |
||
299 | * |
||
300 | * @param $rules |
||
301 | * @return mixed |
||
302 | */ |
||
303 | public function getRulesAttribute($rules) |
||
307 | |||
308 | /** |
||
309 | * Set the stream namespace. |
||
310 | * |
||
311 | * @param StreamInterface $stream |
||
312 | */ |
||
313 | public function setStreamAttribute(StreamInterface $stream) |
||
317 | |||
318 | /** |
||
319 | * Compile the fields's stream. |
||
320 | * |
||
321 | * @return FieldInterface |
||
322 | */ |
||
323 | public function compileStreams() |
||
332 | |||
333 | /** |
||
334 | * Return the assignments relation. |
||
335 | * |
||
336 | * @return HasMany |
||
337 | */ |
||
338 | public function assignments() |
||
342 | } |
||
343 |
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.