1 | <?php |
||
8 | class SchemaValidator |
||
9 | { |
||
10 | /** |
||
11 | * @param object $descriptor |
||
12 | * @return SchemaValidationError[] |
||
13 | */ |
||
14 | public static function validate($descriptor) |
||
19 | |||
20 | /** |
||
21 | * @param object $descriptor |
||
22 | */ |
||
23 | public function __construct($descriptor) |
||
28 | |||
29 | /** |
||
30 | * @return SchemaValidationError[] |
||
31 | */ |
||
32 | public function getValidationErrors() |
||
38 | |||
39 | /** |
||
40 | * @param integer $code |
||
41 | * @param mixed $extraDetails |
||
42 | */ |
||
43 | protected function addError($code, $extraDetails=null) |
||
47 | |||
48 | protected function validateSchema() |
||
65 | } |
||
66 |
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: