Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
5 / 5 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
| JsonSchemaFormatValidator | |
100.00% |
5 / 5 |
|
100.00% |
2 / 2 |
3 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| __invoke | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
2 | |||
| 1 | <?php |
| 2 | namespace Apie\SchemaGenerator\Other; |
| 3 | |
| 4 | use Exception; |
| 5 | |
| 6 | class JsonSchemaFormatValidator |
| 7 | { |
| 8 | public function __construct(private string $className) |
| 9 | { |
| 10 | } |
| 11 | |
| 12 | public function __invoke(string $value): bool |
| 13 | { |
| 14 | try { |
| 15 | new $this->className($value); |
| 16 | return true; |
| 17 | } catch (Exception $error) { |
| 18 | return false; |
| 19 | } |
| 20 | } |
| 21 | } |