lithium\net\http\Media::handlers PHP Method

handlers() public static method

Helper method for listing registered type handlers. Returns all handlers, or the handler for a specific media type, if requested.
public static handlers ( string $type = null ) : mixed
$type string The type of handler to return.
return mixed Array of all handlers, or the handler for a specific type.
    public static function handlers($type = null)
    {
        $handlers = static::$_handlers + array('default' => array('view' => 'lithium\\template\\View', 'encode' => false, 'decode' => false, 'cast' => false, 'paths' => array('template' => '{:library}/views/{:controller}/{:template}.{:type}.php', 'layout' => '{:library}/views/layouts/{:layout}.{:type}.php', 'element' => '{:library}/views/elements/{:template}.{:type}.php')), 'html' => array(), 'json' => array('cast' => true, 'encode' => 'json_encode', 'decode' => function ($data) {
            return json_decode($data, true);
        }), 'text' => array('cast' => false, 'encode' => function ($s) {
            return $s;
        }), 'form' => array('cast' => true, 'encode' => 'http_build_query', 'decode' => function ($data) {
            $decoded = array();
            parse_str($data, $decoded);
            return $decoded;
        }));
        if ($type) {
            return isset($handlers[$type]) ? $handlers[$type] : null;
        }
        return $handlers;
    }