1 | <?php |
||
10 | class SchemaAssertion |
||
11 | { |
||
12 | protected $schema; |
||
13 | |||
14 | /** |
||
15 | * @param array|string $schema |
||
16 | */ |
||
17 | public function __construct($schema) |
||
33 | |||
34 | /** |
||
35 | * Assert JSON against the loaded schema. |
||
36 | * |
||
37 | * @param string $data |
||
38 | * |
||
39 | * @return void |
||
40 | */ |
||
41 | public function assert(string $data) |
||
51 | |||
52 | /** |
||
53 | * Test if the schema is a JSON string. |
||
54 | * |
||
55 | * @param mixed $schema |
||
56 | * |
||
57 | * @return bool |
||
58 | */ |
||
59 | private function isJson($schema) |
||
63 | |||
64 | /** |
||
65 | * Test if the schema is being loaded from the config path. |
||
66 | * |
||
67 | * @param mixed $schema |
||
68 | * |
||
69 | * @return bool |
||
70 | */ |
||
71 | private function isFileFromConfigPath($schema) |
||
76 | |||
77 | /** |
||
78 | * Merge the provided path with the config path and file extension. |
||
79 | * |
||
80 | * @param string $schema |
||
81 | * |
||
82 | * @return string |
||
83 | */ |
||
84 | private function mergeConfigPath($schema) |
||
91 | } |
||
92 |