| Conditions | 3 |
| Paths | 3 |
| Total Lines | 20 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 13 |
| CRAP Score | 3 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 21 | 3 | protected function parseString(string $input) |
|
| 22 | { |
||
| 23 | /** @var array $result */ |
||
| 24 | 3 | $result = \json_decode( |
|
| 25 | 3 | $input, |
|
| 26 | 3 | true, |
|
| 27 | 3 | (int)$this->getOption('depth', 512), |
|
| 28 | 3 | (int)$this->getOption('options', 0) |
|
| 29 | 3 | ); |
|
| 30 | |||
| 31 | //Clear the most recent error |
||
| 32 | 3 | \error_clear_last(); |
|
| 33 | |||
| 34 | 3 | if (\json_last_error() === JSON_ERROR_NONE) { |
|
| 35 | 2 | return $result; |
|
| 36 | } |
||
| 37 | 1 | if ($this->logger instanceof LoggerInterface) { |
|
| 38 | 1 | $this->logger->error(sprintf('(%s) %s', \json_last_error(), \json_last_error_msg())); |
|
| 39 | } |
||
| 40 | 1 | return null; |
|
| 41 | } |
||
| 44 |