1 | <?php |
||
14 | class CodeGenerator { |
||
15 | |||
16 | const SORT_USESTATEMENTS_DEFAULT = 'default'; |
||
17 | |||
18 | const SORT_CONSTANTS_DEFAULT = 'default'; |
||
19 | |||
20 | const SORT_PROPERTIES_DEFAULT = 'default'; |
||
21 | |||
22 | const SORT_METHODS_DEFAULT = 'default'; |
||
23 | |||
24 | /** @var CodeGeneratorConfig */ |
||
25 | protected $config; |
||
26 | |||
27 | /** |
||
28 | * |
||
29 | * @param CodeGeneratorConfig|array $config |
||
30 | */ |
||
31 | 8 | public function __construct($config = null) { |
|
35 | |||
36 | 2 | protected function configure($config = null) { |
|
45 | |||
46 | /** |
||
47 | * Returns the used configuration |
||
48 | * |
||
49 | * @return CodeGeneratorConfig |
||
50 | */ |
||
51 | 1 | public function getConfig() { |
|
54 | |||
55 | /** |
||
56 | * Generates code from a given model |
||
57 | * |
||
58 | * @param GenerateableInterface $model |
||
59 | * @return string the generated code |
||
60 | */ |
||
61 | 6 | public function generate(GenerateableInterface $model) { |
|
69 | |||
70 | } |
||
71 |
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: