| 1 | <?php |
||
| 15 | class Compiler |
||
| 16 | { |
||
| 17 | /** |
||
| 18 | * Constructor. |
||
| 19 | * |
||
| 20 | * @param ParserInterface $parser |
||
| 21 | * @param TokenizerInterface $tokenizer |
||
| 22 | */ |
||
| 23 | 5 | public function __construct($parser = null, $tokenizer = null) |
|
| 28 | |||
| 29 | |||
| 30 | /** |
||
| 31 | * Parses the raw string input and returns the resulting root node. |
||
| 32 | * |
||
| 33 | * @param string $input |
||
| 34 | * @return Node |
||
| 35 | */ |
||
| 36 | 4 | public function parse($input) |
|
| 43 | |||
| 44 | /** |
||
| 45 | * Compile an input string to PHP code |
||
| 46 | * |
||
| 47 | * @param string $input |
||
| 48 | * @return string |
||
| 49 | */ |
||
| 50 | 5 | public function compile($input) |
|
| 64 | } |
||
| 65 |
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: