/** * Execute a REST GET Request * * @param string $path RESTFul path to resource * * @return array|RedBean_OODBBean one or an array of beans */ public function handleRESTGetRequest($path) { if (!is_string($path)) { return null; } $resourceInfo = explode('/', $path); $type = $resourceInfo[0]; try { if (count($resourceInfo) < 2) { return $this->instance->findAll($type); } else { $id = (int) $resourceInfo[1]; return $this->instance->load($type, $id); } } catch (Exception $exception) { return null; } }