function post(Manager $manager, Service $service) { $data = json_decode($GLOBALS['HTTP_RAW_POST_DATA']); if (!is_array($data)) { $response = $service->handle($manager, Request::create($data)); } else { $response = array(); foreach ($data as $request) { $response[] = $service->handle($manager, Request::create($request)); } } header('Content-type: text/javascript'); echo json_encode($response); }
function testServiceArguments() { $service = new Service('Common\\Api', 'Common\\Sys'); $anotherService = new Service(array('Common\\Api', 'Common\\Sys')); $this->assertSame(json_encode($service->getActions()), json_encode($anotherService->getActions())); }