queryParams = $queryParams; } /** * Optional helper constructor to reduce setup * for people who don't really care. */ public static function createFromGlobals() { return new self($_REQUEST); } public function state() { if (! isset($this->queryParams['state'])) { return null; } return $this->queryParams['state']; } public function authorizationCode() { if (! isset($this->queryParams['code'])) { throw new ApplicationRejectedException("Did not receive auth code. " . json_encode($this->queryParams)); } return $this->queryParams['code']; } }