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;
}