1 | <?php |
||
34 | class ModuleJsonConfiguration implements ModuleConfigurationInterface |
||
35 | { |
||
36 | |||
37 | /** |
||
38 | * Holds raw data instance |
||
39 | * |
||
40 | * @var \stdClass |
||
41 | */ |
||
42 | protected $data; |
||
43 | |||
44 | /** |
||
45 | * The module parameters. |
||
46 | * |
||
47 | * @var array |
||
48 | */ |
||
49 | protected $params = array(); |
||
50 | |||
51 | /** |
||
52 | * Constructs config |
||
53 | * |
||
54 | * @param \stdClass $node The JSON node used to build config |
||
55 | */ |
||
56 | public function __construct($node) |
||
63 | |||
64 | /** |
||
65 | * Returns the module's class name. |
||
66 | * |
||
67 | * @return string The module's class name |
||
68 | */ |
||
69 | public function getType() |
||
73 | |||
74 | /** |
||
75 | * Array with the module params to use. |
||
76 | * |
||
77 | * @return array |
||
78 | */ |
||
79 | public function getParams() |
||
83 | |||
84 | /** |
||
85 | * Returns the param with the passed name casted to the specified type. |
||
86 | * |
||
87 | * @param string $name The name of the param to be returned |
||
88 | * |
||
89 | * @return mixed The requested param casted to the specified type |
||
90 | */ |
||
91 | public function getParam($name) |
||
97 | } |
||
98 |
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: