| Conditions | 4 |
| Paths | 6 |
| Total Lines | 21 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 13 |
| CRAP Score | 4 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 36 | 3 | public function toArray(): array |
|
| 37 | { |
||
| 38 | 3 | $result = [ |
|
| 39 | 3 | 'type' => 'expression', |
|
| 40 | 3 | 'name' => $this->outputName, |
|
| 41 | 3 | 'expression' => $this->expression, |
|
| 42 | 3 | ]; |
|
| 43 | |||
| 44 | 3 | if ($this->ordering) { |
|
| 45 | 1 | $result['ordering'] = $this->ordering; |
|
| 46 | } |
||
| 47 | |||
| 48 | 3 | if ($this->outputType) { |
|
| 49 | 2 | if ($this->outputType instanceof DataType) { |
|
| 50 | 1 | $result['outputType'] = $this->outputType->value; |
|
| 51 | } else { |
||
| 52 | 1 | $result['outputType'] = $this->outputType; |
|
| 53 | } |
||
| 54 | } |
||
| 55 | |||
| 56 | 3 | return $result; |
|
| 57 | } |
||
| 58 | } |