/** This method lists all registers from given entity @access public @throws Exception object @param object $objVO @return object */ public function list_all(ValueObject $objVO = null, $options = []) { try { HttpHandler::header(501); } catch (Exception $e) { throw $e; } }
HttpHandler::header(401); } else { if ($this->Authentication) { self::validate_hmac_header(); } else { self::execute_method(); } } } } catch (Exception $ex) { throw $ex; } }
/** This method gets the method annotation stack @access public @throws Exception object @param string $class @param string $key @return array */ public static function get_method($class, $key) { try { if (method_exists($class, $key)) { return self::parser(new ReflectionMethod($class, $key)); } else { HttpHandler::header(501); } } catch (Exception $e) { throw $e; } }
/** Router method for service instantiation purposes, it uses the attribute $RequestStructure values and if they do not exists get from de default in config.xml @access public @throws Exception object @return void */ public function router() { try { //Entity name $entityName = ucfirst(self::request_structure("entity")); //Explode the string $arrEntityName = explode("-", $entityName); //Set entity name $entityName = ""; foreach ($arrEntityName as $en) { $entityName .= ucfirst($en); } $this->RequestStructure["entity"] = $entityName; //Check if service entity exists $serviceEntity = self::request_structure("entity"); $serviceFilePath = self::config('path->physical->service') . $entityName . "SRV.class.php"; if (!is_file($serviceFilePath)) { HttpHandler::header(404); } else { //Execute the service constructor $serviceEntity = "\\Library\\Service\\" . $serviceEntity . 'SRV'; $serviceEntityNewInstance = new $serviceEntity($this); } } catch (Exception $e) { throw $e; } }
/** Check authorization token @access public @throws Exception object @param array $param @return void */ public function check_authorization_token($param = []) { try { $apiToken = explode(" ", $param["user_token"]); if ($apiToken[0] != Application::config("service->authorization_prefix")) { HttpHandler::header(401); } $apiToken[1] = $apiToken[1]; $param["user_token"] = $apiToken[1]; $result = $this->ApiDAO->check_authorization_token($param); if ($result->UserId == 0) { HttpHandler::header(401); } else { $param["user_id"] = $result->UserId; $param["add_datetime"] = Utility::get_datetime(); $this->ApiDAO->insert_system_log($param); $result->ApiToken = $apiToken[1]; } return $result; } catch (Exception $e) { throw $e; } }