/** * Will set the module_opt_pretty variable (array) as a parameter of the server * @param \Rest\Server $server * @return \Rest\Server */ function execute(\Rest\Server $server) { $acceptedMethods = array(self::HTTP_METHOD_GET, self::HTTP_METHOD_POST, self::HTTP_METHOD_PUT, self::HTTP_METHOD_DELETE); // get the request URL parameters and find the opt_method array $method = $server->getRequest()->getGet("opt_method"); if (isset($method)) { $method = strtoupper($method); if (in_array($method, $acceptedMethods)) { $server->getRequest()->setMethod($method); $_SERVER['REQUEST_METHOD'] = $method; } } return $server; }
/** * Will set the module_opt_pretty variable (array) as a parameter of the server * @param \Rest\Server $server * @return \Rest\Server */ function execute(\Rest\Server $server) { // get the request URL parameters and find the opt_pretty array $pretty = $server->getRequest()->getGet("opt_pretty"); if (isset($pretty)) { $server->setParameter(self::MODULE_OPT_PRETTY, true); } return $server; }
/** * Will set the module_opt_extended variable (array) as a parameter of the server * @param \Rest\Server $server * @return \Rest\Server */ function execute(\Rest\Server $server) { // get the request URL parameters and find the opt_extended array $fields = $server->getRequest()->getGet("opt_fields"); if (!empty($fields)) { $options = $this->__explodePath($fields, ","); $server->setParameter(self::MODULE_OPT_FIELDS, $options); } return $server; }