1 | <?php |
||
11 | abstract class SchemaFieldAbstract implements SchemaFieldTypeInterface |
||
12 | { |
||
13 | use MigrationField, CrudColumn, CrudField, ValidationRule; |
||
14 | |||
15 | /** |
||
16 | * The name of the entity |
||
17 | * |
||
18 | * @var string |
||
19 | */ |
||
20 | public $name; |
||
21 | |||
22 | /** |
||
23 | * Keywords that can be used in schema string |
||
24 | * |
||
25 | * @var array |
||
26 | */ |
||
27 | private $availableMethods = [ |
||
28 | 'field' => 'setCrudFieldOptions', |
||
29 | 'column' => 'setCrudColumnOptions', |
||
30 | 'rule' => 'setValidationRule', |
||
31 | ]; |
||
32 | |||
33 | /** |
||
34 | * SchemaFieldAbstract constructor. |
||
35 | * |
||
36 | * @param array $fieldOptions |
||
37 | * @param array $crudOptions |
||
38 | */ |
||
39 | public function __construct(array $fieldOptions, array $crudOptions = []) |
||
46 | |||
47 | /** |
||
48 | * Go through any additionally provided CRUD (field, column or rule |
||
49 | * |
||
50 | * @param array $crudOptions |
||
51 | */ |
||
52 | private function parseCrudOptions(array $crudOptions): void |
||
58 | |||
59 | /** |
||
60 | * Parse the given string and call the corresponding method if exists |
||
61 | * |
||
62 | * @param string $crudOption |
||
63 | */ |
||
64 | private function parseCrudOption(string $crudOption) |
||
72 | |||
73 | /** |
||
74 | * Set options coming from inside the parenthesises |
||
75 | * |
||
76 | * @param string $variableName |
||
77 | * @param string $options |
||
78 | */ |
||
79 | private function setOptions(string $variableName, string $options): void |
||
92 | } |
||
93 |
This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.