Total Complexity | 2 |
Total Lines | 17 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php declare(strict_types=1); |
||
9 | final class CannotFormatJson extends InvalidArgumentException implements Unformattable |
||
10 | { |
||
11 | public static function because(RestResource $resource, Throwable $reason): self |
||
12 | { |
||
13 | return new self(sprintf( |
||
14 | 'Could not format the resource `%s` as json, because: %s', |
||
15 | $resource->name(), |
||
16 | $reason->getMessage() |
||
17 | ), $reason->getCode(), $reason); |
||
18 | } |
||
19 | |||
20 | public static function jsonError(RestResource $resource, string $error): self |
||
26 | )); |
||
27 | } |
||
29 |