| Total Complexity | 6 |
| Total Lines | 61 |
| Duplicated Lines | 0 % |
| Coverage | 91.67% |
| Changes | 0 | ||
| 1 | <?php |
||
| 13 | abstract class AbstractStringBasedType extends ScalarType |
||
| 14 | { |
||
| 15 | /** |
||
| 16 | * Validate value |
||
| 17 | * |
||
| 18 | * @param mixed $value |
||
| 19 | * |
||
| 20 | * @return bool |
||
| 21 | */ |
||
| 22 | abstract protected function isValid($value): bool; |
||
| 23 | |||
| 24 | /** |
||
| 25 | * Serializes an internal value to include in a response. |
||
| 26 | * |
||
| 27 | * @param mixed $value |
||
| 28 | * |
||
| 29 | * @return mixed |
||
| 30 | */ |
||
| 31 | 13 | public function serialize($value) |
|
| 32 | { |
||
| 33 | // Assuming internal representation of url is always correct: |
||
| 34 | 13 | return $value; |
|
| 35 | } |
||
| 36 | |||
| 37 | /** |
||
| 38 | * Parses an externally provided value (query variable) to use as an input |
||
| 39 | * |
||
| 40 | * @param mixed $value |
||
| 41 | * |
||
| 42 | * @return mixed |
||
| 43 | */ |
||
| 44 | 13 | public function parseValue($value) |
|
| 51 | } |
||
| 52 | |||
| 53 | /** |
||
| 54 | * Parses an externally provided literal value to use as an input (e.g. in Query AST) |
||
| 55 | * |
||
| 56 | * @param $ast Node |
||
| 57 | * @param null|array $variables |
||
| 58 | * |
||
| 59 | * @return null|string |
||
| 60 | */ |
||
| 61 | 16 | public function parseLiteral($ast, array $variables = null) |
|
| 76 |