@@ 28-37 (lines=10) @@ | ||
25 | * @return array |
|
26 | * @throws \NeedleProject\FileIo\Exception\ContentException |
|
27 | */ |
|
28 | public function getArray(): array |
|
29 | { |
|
30 | $content = json_decode($this->get(), true); |
|
31 | if (json_last_error() !== JSON_ERROR_NONE) { |
|
32 | throw new ContentException( |
|
33 | sprintf("Could not decode content, got %s", json_last_error_msg()) |
|
34 | ); |
|
35 | } |
|
36 | return $content; |
|
37 | } |
|
38 | ||
39 | /** |
|
40 | * @return \stdClass |
|
@@ 43-52 (lines=10) @@ | ||
40 | * @return \stdClass |
|
41 | * @throws \NeedleProject\FileIo\Exception\ContentException |
|
42 | */ |
|
43 | public function getObject() |
|
44 | { |
|
45 | $content = json_decode($this->get()); |
|
46 | if (json_last_error() !== JSON_ERROR_NONE) { |
|
47 | throw new ContentException( |
|
48 | sprintf("Could not decode content, got %s", json_last_error_msg()) |
|
49 | ); |
|
50 | } |
|
51 | return $content; |
|
52 | } |
|
53 | } |
|
54 |