File tree Expand file tree Collapse file tree 1 file changed +3
-18
lines changed Expand file tree Collapse file tree 1 file changed +3
-18
lines changed Original file line number Diff line number Diff line change 88use JsonException ;
99use Nejcc \PhpDatatypes \Interfaces \DecoderInterface ;
1010use Nejcc \PhpDatatypes \Interfaces \EncoderInterface ;
11-
11+ use Nejcc \ PhpDatatypes \ Abstract \ ArrayAbstraction ;
1212
1313/**
1414 * Class Json
1515 * A strict and immutable type for handling JSON data with advanced features.
1616 */
17- final class Json
17+ final class Json extends ArrayAbstraction
1818{
1919 /**
2020 * @var string The JSON string.
@@ -43,24 +43,9 @@ public function __construct(string $json, ?string $schema = null)
4343 $ this ->validateJson ($ json );
4444 $ this ->schema = $ schema ;
4545 $ this ->json = $ json ;
46+ parent ::__construct ([]); // Not used, but required by ArrayAbstraction
4647 }
4748
48- /**
49- * Validates if a string is valid JSON.
50- *
51- * @param string $json
52- * @throws InvalidArgumentException
53- */
54- private function validateJson (string $ json ): void
55- {
56- try {
57- json_decode ($ json , true , 512 , JSON_THROW_ON_ERROR );
58- } catch (JsonException $ e ) {
59- throw new InvalidArgumentException ('Invalid JSON provided: ' . $ e ->getMessage ());
60- }
61- }
62-
63-
6449 /**
6550 * Serializes the JSON data to an array.
6651 *
You can’t perform that action at this time.
0 commit comments