| 1 | <?php |
||
| 8 | class Desmond |
||
| 9 | { |
||
| 10 | private $lexer; |
||
| 11 | private $eval; |
||
| 12 | |||
| 13 | 6 | public function __construct() |
|
| 18 | |||
| 19 | 6 | public function run($command) |
|
| 20 | { |
||
| 21 | 6 | if (empty($command)) { |
|
| 22 | 1 | return ''; |
|
| 23 | } |
||
| 24 | try { |
||
| 25 | 5 | $ast = $this->lexer->readString($command); |
|
| 26 | 4 | $value = $this->eval->getReturn($ast); |
|
| 27 | 1 | } catch (\Exception $exception) { |
|
| 28 | 1 | return $exception->getMessage(); |
|
| 29 | } |
||
| 30 | 4 | return $value; |
|
| 31 | } |
||
| 32 | |||
| 33 | 1 | public function loadFile($file) |
|
| 37 | |||
| 38 | 2 | public function pretty($value) |
|
| 42 | } |
||
| 43 |