1 | <?php declare(strict_types=1); |
||
9 | class Validator |
||
10 | { |
||
11 | /** |
||
12 | * @var JsonGuardValidator |
||
13 | */ |
||
14 | private $validator; |
||
15 | |||
16 | /** |
||
17 | * Validator constructor. |
||
18 | * |
||
19 | * @param mixed $data |
||
20 | * @param object $schema |
||
21 | * @param null|ContainerInterface $ruleSet |
||
22 | */ |
||
23 | 6 | public function __construct($data, $schema, ?ContainerInterface $ruleSet = null) |
|
27 | |||
28 | /** |
||
29 | * Determines if the data passes schema validation. |
||
30 | * |
||
31 | * @return bool |
||
32 | * |
||
33 | * @throws \League\JsonGuard\Exception\InvalidSchemaException |
||
34 | * @throws \League\JsonGuard\Exception\MaximumDepthExceededException |
||
35 | */ |
||
36 | 3 | public function passes(): bool |
|
40 | |||
41 | /** |
||
42 | * Determines if the data does not pass schema validation. |
||
43 | * |
||
44 | * @return bool |
||
45 | * |
||
46 | * @throws \League\JsonGuard\Exception\InvalidSchemaException |
||
47 | * @throws \League\JsonGuard\Exception\MaximumDepthExceededException |
||
48 | */ |
||
49 | 6 | public function fails(): bool |
|
53 | |||
54 | /** |
||
55 | * @return array|ValidationError[] |
||
56 | * |
||
57 | * @throws \League\JsonGuard\Exception\InvalidSchemaException |
||
58 | * @throws \League\JsonGuard\Exception\MaximumDepthExceededException |
||
59 | */ |
||
60 | 3 | public function errors(): array |
|
64 | |||
65 | /** |
||
66 | * Get a Problem Details object describing the errors with the validated data |
||
67 | * |
||
68 | * @param null|string $title |
||
69 | * @param int|null $status |
||
70 | * @param null|string $detail |
||
71 | * |
||
72 | * @return ProblemDetails |
||
73 | */ |
||
74 | 3 | public function getProblemDetails( |
|
86 | |||
87 | /** |
||
88 | * @return mixed |
||
89 | */ |
||
90 | 3 | private function getContextForProblemDetails(): array |
|
102 | } |
||
103 |