mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-16 14:33:14 +00:00
Add use of core serializer
This commit is contained in:
@@ -33,27 +33,43 @@ class PathFileTest implements ControllerProviderInterface
|
||||
$controllers = new ControllerCollection();
|
||||
|
||||
$controllers->get('/path/', function() use ($app)
|
||||
{
|
||||
$path = $app['request']->get('path');
|
||||
{
|
||||
$path = $app['request']->get('path');
|
||||
|
||||
return new Response(\p4string::jsonencode(array(
|
||||
'exists' => file_exists($path)
|
||||
, 'file' => is_file($path)
|
||||
, 'dir' => is_dir($path)
|
||||
, 'readable' => is_readable($path)
|
||||
, 'writeable' => is_writable($path)
|
||||
, 'executable' => is_executable($path)
|
||||
)), 200, array('application/json'));
|
||||
});
|
||||
$Serializer = $app['Core']['Serializer'];
|
||||
|
||||
return new Response(
|
||||
$Serializer->serialize(
|
||||
array(
|
||||
'exists' => file_exists($path)
|
||||
, 'file' => is_file($path)
|
||||
, 'dir' => is_dir($path)
|
||||
, 'readable' => is_readable($path)
|
||||
, 'writeable' => is_writable($path)
|
||||
, 'executable' => is_executable($path)
|
||||
)
|
||||
, 'json'
|
||||
)
|
||||
, 200
|
||||
, array('application/json')
|
||||
);
|
||||
});
|
||||
|
||||
$controllers->get('/url/', function() use ($app)
|
||||
{
|
||||
$url = $app['request']->get('url');
|
||||
{
|
||||
$url = $app['request']->get('url');
|
||||
|
||||
return new Response(\p4string::jsonencode(array(
|
||||
'code' => \http_query::getHttpCodeFromUrl($url)
|
||||
)), 200, array('application/json'));
|
||||
});
|
||||
return new Response(
|
||||
$Serializer->serialize(
|
||||
array(
|
||||
'code' => \http_query::getHttpCodeFromUrl($url)
|
||||
)
|
||||
, 'json'
|
||||
)
|
||||
, 200
|
||||
, array('application/json')
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
return $controllers;
|
||||
|
Reference in New Issue
Block a user