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
$type
Specifies the media type into which
$data
will be encoded. This media type must have an'encode'
setting specified inMedia::$_handlers
. -
mixed
$data
Arbitrary data you wish to encode. Note that some encoders can only handle arrays or objects.
-
array
$options
Handler-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);
}