1 | <?php |
||
11 | abstract class Field implements FieldContract, Arrayable, Jsonable, JsonSerializable |
||
12 | { |
||
13 | protected $type; |
||
14 | |||
15 | protected $name; |
||
16 | protected $title; |
||
17 | |||
18 | public function __construct($name, $title) |
||
23 | |||
24 | public function isRelationship() |
||
28 | |||
29 | public function toArray() |
||
37 | |||
38 | public function jsonSerialize() |
||
42 | |||
43 | public function toJson($options = 0) |
||
47 | |||
48 | public function __toString() |
||
52 | } |
||
53 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: