1 | <?php |
||
13 | abstract class BaseTransformer implements TransformerInterface |
||
14 | { |
||
15 | |||
16 | /** |
||
17 | * Data to transform |
||
18 | * |
||
19 | * @var array |
||
20 | */ |
||
21 | private $data; |
||
22 | |||
23 | /** |
||
24 | * Set the data to transform |
||
25 | * |
||
26 | * @param array $data |
||
27 | * @return void |
||
28 | */ |
||
29 | public function setData(array $data) |
||
33 | |||
34 | /** |
||
35 | * Returns the data to transform |
||
36 | * |
||
37 | * @return array |
||
38 | */ |
||
39 | public function getData() |
||
43 | |||
44 | /** |
||
45 | * Returns the supported index names by the Gerrit API. |
||
46 | * |
||
47 | * @return array |
||
48 | */ |
||
49 | public function getSupportedKeys() |
||
53 | |||
54 | /** |
||
55 | * Checks if the current data transformer is responsible to transform the given data. |
||
56 | * |
||
57 | * @return boolean |
||
58 | */ |
||
59 | public function isResponsible() |
||
63 | |||
64 | /** |
||
65 | * Transforms the data into one unique format |
||
66 | * |
||
67 | * @return array |
||
68 | */ |
||
69 | abstract public function transform(); |
||
70 | } |
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: