1 | <?php |
||
10 | class SchemaAssertion |
||
11 | { |
||
12 | protected $schema; |
||
13 | |||
14 | /** |
||
15 | * @param array|string $schema |
||
16 | * |
||
17 | * @return void |
||
|
|||
18 | */ |
||
19 | 5 | public function __construct($schema) |
|
35 | |||
36 | /** |
||
37 | * Assert JSON against the loaded schema. |
||
38 | * |
||
39 | * @param string $data |
||
40 | * |
||
41 | * @return void |
||
42 | */ |
||
43 | 5 | public function assert(string $data) |
|
53 | |||
54 | /** |
||
55 | * Test if the schema is a JSON string. |
||
56 | * |
||
57 | * @param mixed $schema |
||
58 | * |
||
59 | * @return bool |
||
60 | */ |
||
61 | 5 | private function isJson($schema) |
|
65 | |||
66 | /** |
||
67 | * Test if the schema is being loaded from the config path. |
||
68 | * |
||
69 | * @param mixed $schema |
||
70 | * |
||
71 | * @return bool |
||
72 | */ |
||
73 | 5 | private function isFileFromConfigPath($schema) |
|
78 | |||
79 | /** |
||
80 | * Merge the provided path with the config path and file extension. |
||
81 | * |
||
82 | * @param string $schema |
||
83 | * |
||
84 | * @return string |
||
85 | */ |
||
86 | 2 | private function mergeConfigPath($schema) |
|
93 | } |
||
94 |
Adding a
@return
annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.