1 | <?php |
||
14 | abstract class Field { |
||
15 | |||
16 | private $form = null, $posted = false; |
||
17 | |||
18 | protected $key = '', $name = '', $id = '', $value = null; |
||
19 | |||
20 | protected $config = [], $dataset = null; |
||
21 | |||
22 | /** |
||
23 | * Initiazlize field with an owner form, a key, and additional configuration |
||
24 | */ |
||
25 | |||
26 | protected function init(Form $form, string $key, array $config = []) { |
||
47 | |||
48 | /** |
||
49 | * Get a DOM element with a given name, a value, and a set of attributes |
||
50 | */ |
||
51 | |||
52 | protected function getTag(string $name, array $attributes = [], $contents = null) : Tag { |
||
70 | |||
71 | /** |
||
72 | * Catch a POST value by the field key |
||
73 | * |
||
74 | * @return true on success or false on failure |
||
75 | */ |
||
76 | |||
77 | public function post() : bool { |
||
87 | |||
88 | /** |
||
89 | * Check if a POST value has been catched |
||
90 | */ |
||
91 | |||
92 | public function isPosted() : bool { |
||
96 | |||
97 | /** |
||
98 | * Get the field key |
||
99 | */ |
||
100 | |||
101 | public function getKey() : string { |
||
105 | |||
106 | /** |
||
107 | * Get the field name |
||
108 | */ |
||
109 | |||
110 | public function getName() : string { |
||
114 | |||
115 | /** |
||
116 | * Get the field id |
||
117 | */ |
||
118 | |||
119 | public function getId() : string { |
||
123 | |||
124 | /** |
||
125 | * Get the field value |
||
126 | */ |
||
127 | |||
128 | public function getValue() { |
||
132 | |||
133 | /** |
||
134 | * Set a configuration value |
||
135 | */ |
||
136 | |||
137 | public function __set(string $name, $value) { |
||
141 | |||
142 | /** |
||
143 | * Get a configuration value |
||
144 | */ |
||
145 | |||
146 | public function __get(string $name) { |
||
150 | |||
151 | /** |
||
152 | * Check if a configuration value is set |
||
153 | */ |
||
154 | |||
155 | public function __isset(string $name) : bool { |
||
159 | } |
||
160 | } |
||
161 |
Since your code implements the magic getter
_get
, this function will be called for any read access on an undefined variable. You can add the@property
annotation to your class or interface to document the existence of this variable.If the property has read access only, you can use the @property-read annotation instead.
Of course, you may also just have mistyped another name, in which case you should fix the error.
See also the PhpDoc documentation for @property.