1 | <?php |
||
14 | class ModelGenerator { |
||
15 | |||
16 | /** @var Writer */ |
||
17 | private $writer; |
||
18 | |||
19 | /** @var BuilderFactory */ |
||
20 | private $factory; |
||
21 | |||
22 | /** @var CodeGeneratorConfig */ |
||
23 | private $config; |
||
24 | |||
25 | /** |
||
26 | * |
||
27 | * @param CodeGeneratorConfig|array $config |
||
28 | */ |
||
29 | 39 | public function __construct($config = null) { |
|
46 | |||
47 | /** |
||
48 | * @return CodeGeneratorConfig |
||
49 | */ |
||
50 | 39 | public function getConfig() { |
|
53 | |||
54 | /** |
||
55 | * @return Writer |
||
56 | */ |
||
57 | 39 | public function getWriter() { |
|
60 | |||
61 | /** |
||
62 | * @return BuilderFactory |
||
63 | */ |
||
64 | 6 | public function getFactory() { |
|
67 | |||
68 | /** |
||
69 | * @param AbstractModel $model |
||
70 | * @return string |
||
71 | */ |
||
72 | 37 | public function generate(AbstractModel $model) { |
|
86 | } |
||
87 |
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: