| Conditions | 3 |
| Paths | 5 |
| Total Lines | 14 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 3.0987 |
| Changes | 0 | ||
| 1 | <?php |
||
| 50 | 5 | public function compile($input) |
|
| 51 | { |
||
| 52 | 5 | if (strlen($input) == 0) { |
|
| 53 | 1 | return null; |
|
| 54 | } |
||
| 55 | try { |
||
| 56 | 4 | $buffer = new Buffer(); |
|
| 57 | 4 | $this->parse($input)->compile($buffer); |
|
| 58 | 4 | $code = $buffer->getResult(); |
|
| 59 | 4 | return $code; |
|
| 60 | } catch (\UnexpectedValueException $e) { |
||
| 61 | throw new \UnexpectedValueException('Error while compiling input: ' . Util::toPhp($input), 0, $e); |
||
| 62 | } |
||
| 63 | } |
||
| 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: