datatable.directory codebase https://datatable.directory/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

38 lines
888 B

<?php namespace SocialNorm;
use SocialNorm\Exceptions\ApplicationRejectedException;
final class Request
{
private $queryParams;
public function __construct($queryParams)
{
$this->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'];
}
}