1 | <?php |
||
11 | class PropertyEncoder |
||
12 | { |
||
13 | public function __construct(string $prefix, string $uri) |
||
18 | |||
19 | /** |
||
20 | * Encode a field name. If the field reprents a compound type then $key |
||
21 | * should be passed to represent the key for the value of the compound |
||
22 | * field. |
||
23 | */ |
||
24 | public function encode(string $fieldName, string $key = null): string |
||
39 | |||
40 | /** |
||
41 | * Return the PHPCR namespace prefix (alias). |
||
42 | */ |
||
43 | public function getPrefix(): string |
||
47 | |||
48 | /** |
||
49 | * Return the namespace URI. |
||
50 | */ |
||
51 | public function getUri(): string |
||
55 | } |
||
56 |
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: