|
MediaWiki master
|
Inherits Wikimedia\JsonCodec\JsonCodec, and MediaWiki\Json\JsonDeserializer.

Public Member Functions | |||||||||
| __construct (?ContainerInterface $services=null) | |||||||||
| Create a new JsonCodec, with optional access to the provided services. | |||||||||
| deserialize ( $json, ?string $expectedClass=null) | |||||||||
Restore an instance of simple type or JsonDeserializable subclass from the JSON serialization.It supports passing array/object to allow manual decoding of the JSON string if needed.
| |||||||||
| deserializeArray (array $array) | |||||||||
| Helper to deserialize an array of JsonDeserializable instances or simple types. | |||||||||
| detectNonSerializableData ( $value, bool $expectDeserialize=false) | |||||||||
| Checks if the $value is JSON-serializable (contains only scalar values) and returns a JSON-path to the first non-serializable property encountered. | |||||||||
| serialize ( $value) | |||||||||
| unserialize ( $json, ?string $expectedClass=null) | |||||||||
| unserializeArray (array $array) | |||||||||
Protected Member Functions | |
| codecFor (string $className) | |
| Support the JsonCodecable interface by maintaining a mapping of class names to codecs. | |
| isArrayMarked (array $value) | |
| markArray (array &$value, string $className, ?string $classHint) | |
| unmarkArray (array &$value, ?string $classHint) | |
Definition at line 28 of file JsonCodec.php.
| MediaWiki\Json\JsonCodec::__construct | ( | ?ContainerInterface | $services = null | ) |
Create a new JsonCodec, with optional access to the provided services.
Definition at line 49 of file JsonCodec.php.
|
protected |
Support the JsonCodecable interface by maintaining a mapping of class names to codecs.
| class-string | $className |
Definition at line 59 of file JsonCodec.php.
| MediaWiki\Json\JsonCodec::deserialize | ( | $json, | |
| ?string | $expectedClass = null ) |
Restore an instance of simple type or JsonDeserializable subclass from the JSON serialization.It supports passing array/object to allow manual decoding of the JSON string if needed.
| array | string | object | $json | |
| string | null | $expectedClass | What class to expect in deserialization. If null, no expectation. Must be a descendant of JsonDeserializable. |
| JsonException | if the passed $json can't be deserialized. |
Implements MediaWiki\Json\JsonDeserializer.
Definition at line 137 of file JsonCodec.php.
Referenced by BenchmarkJsonCodec\execute().
| MediaWiki\Json\JsonCodec::deserializeArray | ( | array | $array | ) |
Helper to deserialize an array of JsonDeserializable instances or simple types.
| array | $array |
Implements MediaWiki\Json\JsonDeserializer.
Definition at line 189 of file JsonCodec.php.
| MediaWiki\Json\JsonCodec::detectNonSerializableData | ( | $value, | |
| bool | $expectDeserialize = false ) |
Checks if the $value is JSON-serializable (contains only scalar values) and returns a JSON-path to the first non-serializable property encountered.
| mixed | $value | |
| bool | $expectDeserialize | whether to expect the $value to be deserializable with JsonDeserializer. |
Definition at line 321 of file JsonCodec.php.
Referenced by BenchmarkJsonCodec\execute().
|
protected |
Definition at line 99 of file JsonCodec.php.
|
protected |
Definition at line 87 of file JsonCodec.php.
References MediaWiki\Json\JsonConstants\COMPLEX_ANNOTATION, and MediaWiki\Json\JsonConstants\TYPE_ANNOTATION.
| MediaWiki\Json\JsonCodec::serialize | ( | $value | ) |
Definition at line 200 of file JsonCodec.php.
Referenced by BenchmarkJsonCodec\execute().
|
protected |
Definition at line 112 of file JsonCodec.php.
| MediaWiki\Json\JsonCodec::unserialize | ( | $json, | |
| ?string | $expectedClass = null ) |
Implements MediaWiki\Json\JsonDeserializer.
Definition at line 131 of file JsonCodec.php.
References wfDeprecated().
| MediaWiki\Json\JsonCodec::unserializeArray | ( | array | $array | ) |
Implements MediaWiki\Json\JsonDeserializer.
Definition at line 184 of file JsonCodec.php.