@@ 24-35 (lines=12) @@ | ||
21 | * |
|
22 | * @param array|string $data |
|
23 | */ |
|
24 | public function __construct($data) |
|
25 | { |
|
26 | // when given a string, decode from JSON |
|
27 | if (is_string($data)) { |
|
28 | $data = json_decode($data, true); |
|
29 | } |
|
30 | // make sure we got an array |
|
31 | if (!is_array($data)) { |
|
32 | throw new InvalidArgumentException('schema must be given as array or JSON string'); |
|
33 | } |
|
34 | $this->jsonFile = $data; |
|
35 | } |
|
36 | ||
37 | public function getServerUrl() |
|
38 | { |
@@ 21-33 (lines=13) @@ | ||
18 | * @param array|string $data |
|
19 | * @param bool $allowNullValues |
|
20 | */ |
|
21 | public function __construct($data, $allowNullValues = false) |
|
22 | { |
|
23 | // when given a string, decode from JSON |
|
24 | if (is_string($data)) { |
|
25 | $data = json_decode($data, true); |
|
26 | } |
|
27 | // make sure we got an array |
|
28 | if (!is_array($data)) { |
|
29 | throw new InvalidArgumentException('schema must be given as array or JSON string'); |
|
30 | } |
|
31 | $this->jsonFile = $data; |
|
32 | $this->allowNullValues = (bool) $allowNullValues; |
|
33 | } |
|
34 | ||
35 | public function getHttpSchema() |
|
36 | { |