| Conditions | 3 |
| Paths | 3 |
| Total Lines | 13 |
| Code Lines | 5 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 5 |
| CRAP Score | 3.0416 |
| Changes | 0 | ||
| 1 | <?php |
||
| 61 | 16 | public function parseLiteral($ast, array $variables = null) |
|
| 62 | { |
||
| 63 | // Note: throwing GraphQL\Error\Error vs \UnexpectedValueException to benefit from GraphQL |
||
| 64 | // error location in query: |
||
| 65 | 16 | if (!($ast instanceof StringValueNode)) { |
|
| 66 | throw new Error('Query error: Can only parse strings got: ' . $ast->kind, [$ast]); |
||
| 67 | } |
||
| 68 | |||
| 69 | 16 | if (!$this->isValid($ast->value)) { |
|
| 70 | 7 | throw new Error('Query error: Not a valid ' . $this->name, [$ast]); |
|
| 71 | } |
||
| 72 | |||
| 73 | 9 | return $ast->value; |
|
| 74 | } |
||
| 76 |