public static function createFromGlobals() { $request = new self(); $request->setGet(new ParameterBag($_GET)); $request->setPost(new ParameterBag($_POST)); $request->setCookie(new ParameterBag($_COOKIE)); $request->setSession(new ParameterBag($_SESSION)); $request->setServer(new ParameterBag($_SERVER)); $request->setFile(new ParameterBag($_FILES)); return $request; }
/** * {@inheritdoc} * * @param mixed $data * @return \Wooppay\Objects\Response\Login * @throws \Wooppay\Objects\Exceptions\BadCredentials * @throws \Wooppay\Objects\Exceptions\UnsuccessfulResponse */ public static function factory($data) { $response = new self(); if (self::checkResponse($data)) { $response->setSession($data->response->session)->setId($data->response->id)->setUsername($data->response->username)->setLogin($data->response->login)->setType($data->response->type)->setRoles($data->response->roles); } return $response; }