| Conditions | 6 |
| Paths | 6 |
| Total Lines | 29 |
| Code Lines | 17 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 17 | public function run(CodeBlock $codeBlock): array |
||
| 18 | { |
||
| 19 | $outcomes = []; |
||
| 20 | |||
| 21 | ob_start(); |
||
| 22 | |||
| 23 | try { |
||
| 24 | $returnValue = eval($codeBlock); |
||
|
1 ignored issue
–
show
|
|||
| 25 | |||
| 26 | if ($returnValue) { |
||
| 27 | $outcomes[] = new ReturnOutcome( |
||
| 28 | is_scalar($returnValue) ? @(string)$returnValue : '', |
||
| 29 | gettype($returnValue), |
||
| 30 | is_object($returnValue) ? get_class($returnValue) : '' |
||
| 31 | ); |
||
| 32 | } |
||
| 33 | } catch (\Exception $e) { |
||
| 34 | $outcomes[] = new ExceptionOutcome( |
||
| 35 | get_class($e), |
||
| 36 | $e->getMessage(), |
||
| 37 | $e->getCode() |
||
| 38 | ); |
||
| 39 | } |
||
| 40 | |||
| 41 | if ($output = ob_get_clean()) { |
||
| 42 | $outcomes[] = new OutputOutcome($output); |
||
| 43 | } |
||
| 44 | |||
| 45 | return $outcomes; |
||
| 46 | } |
||
| 48 |