lithium\net\http\Media::decode()
For media types registered in $_handlers which include an 'decode' setting, decodes data
according to the specified media type.
Parameters
-
string
$typeSpecifies the media type into which
$datawill be encoded. This media type must have an'encode'setting specified inMedia::$_handlers. -
mixed
$dataArbitrary data you wish to encode. Note that some encoders can only handle arrays or objects.
-
array
$optionsHandler-specific options.
Returns
mixedSource
public static function decode($type, $data, array $options = []) {
if ((!$handler = static::handlers($type)) || empty($handler['decode'])) {
return null;
}
$method = $handler['decode'];
return is_string($method) ? $method($data) : $method($data, $handler + $options);
}