本文整理汇总了PHP中static::request方法的典型用法代码示例。如果您正苦于以下问题:PHP static::request方法的具体用法?PHP static::request怎么用?PHP static::request使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类static
的用法示例。
在下文中一共展示了static::request方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: makeRequest
public function makeRequest(Request $request)
{
static::$request = $request;
return static::$response;
}
示例2: find
/**
* Find a single element by its ID
*
* @param mixed $id
* @return Daursu\Xero\BaseModel
*/
public static function find($id)
{
$object = new static();
$response = $object->request('GET', sprintf('%s/%s', $object->getUrl(), $id));
return $response ? $object : false;
}
示例3: disconnect
/**
* Disconnect current \Hybrid\Request connection
*
* @static
* @access public
*/
public static function disconnect()
{
static::$request = null;
}
示例4: __construct
/**
* Builds the required static objects for later use
*
* @return void
* @author Dan Cox
*/
public function __construct()
{
// Build Aura's Router
$factory = new RouterFactory();
static::$router = $factory->newInstance();
// Build the request object
static::$request = Request::createFromGlobals();
}
示例5: __construct
/**
* Runner constructor.
*/
public function __construct()
{
static::$request = Request::createFromGlobals();
if (!static::$request->hasPreviousSession()) {
$session = new Session();
$session->start();
static::$request->setSession($session);
}
}
示例6: getRequest
/**
* Retrieve a object of JSON-RPC request.
*
* @return object The request object.
*/
public static function getRequest()
{
if (static::$request == null) {
$http = Http\Request::getInstance();
$body = $http->getBody();
static::$request = Request::fromJson($body);
}
return static::$request;
}
示例7:
static function get_request()
{
if (!isset(static::$request)) {
$version = @$_POST['version'];
// If API version changes, could return
// different EnvayaSMS_Request instance
// to support multiple phone versions
static::$request = new EnvayaSMS_Request();
}
return static::$request;
}
示例8: get
public static function get()
{
if (isset(static::$request)) {
return static::$request;
}
if (isset($_SERVER['REQUEST_METHOD'])) {
static::$request = new HTTPRequest();
} else {
throw new RequestTypeNotImplementedException();
}
return static::$request;
}
示例9: __construct
public function __construct()
{
$dir = __DIR__ . '/db/';
$file = 'oauth.sqlite';
if (!file_exists($dir . $file)) {
include_once $dir . 'rebuild_db.php';
}
static::$storage = new OAuth2_Storage_Pdo(array('dsn' => 'sqlite:' . $dir . $file));
static::$request = OAuth2_Request::createFromGlobals();
static::$server = new OAuth2_Server(static::$storage);
static::$server->addGrantType(new OAuth2_GrantType_AuthorizationCode(static::$storage));
}
示例10: init
/**
* Builds the routes then processes the request to the controller and method.
* @param array $config The config array with the controller path and routes.
*/
public static function init(array $config)
{
static::$controller_path = $config['controller_path'];
foreach ($config['routes'] as $route => $args) {
if (!is_array($args)) {
$args = array($args, 'params' => array());
}
static::$routes[$route] = $args;
}
static::$request = static::get_request();
static::route();
}
示例11: __construct
public function __construct()
{
$dir = __DIR__ . '/db/';
$file = 'oauth.sqlite';
if (!file_exists($dir . $file)) {
include_once $dir . 'rebuild_db.php';
}
static::$storage = new Pdo(array('dsn' => 'sqlite:' . $dir . $file));
// create array of supported grant types
$grantTypes = array('authorization_code' => new AuthorizationCode(static::$storage), 'user_credentials' => new UserCredentials(static::$storage));
static::$request = Request::createFromGlobals();
static::$server = new OAuth2Server(static::$storage, array('enforce_state' => true, 'allow_implicit' => true), $grantTypes);
}
示例12: __construct
public function __construct()
{
static::$instance = $this;
static::$request = $_REQUEST;
static::$get = $_GET;
static::$post = $_POST;
static::$server = $_SERVER;
static::$headers = static::getAllHeaders();
static::$requestUri = static::prepareRequestUri();
static::$baseUrl = static::prepareBaseUrl();
static::$basePath = static::prepareBasePath();
static::$pathInfo = static::preparePathInfo();
static::$method = static::$server['REQUEST_METHOD'];
}
示例13: __construct
public function __construct($config)
{
static::$config = $config;
static::$request = $this->request();
static::$cache = new Cache();
$this->connection = static::connect();
if (isset($_REQUEST['upgrade'])) {
$this->checkDBVersion();
}
if (isset($_REQUEST['cssbump'])) {
$this->setOption('cssv', time());
}
if (rand(0, 100) <= 10) {
Auth::cleanSessions();
}
// 10% chance; should be moved to a cron job
}
示例14: getAll
public function getAll()
{
static::$request = array_merge(['METHOD' => $_SERVER['REQUEST_METHOD']], ["SERVER" => $_SERVER ? $_SERVER : []], ["COOKIE" => $_COOKIE ? $_COOKIE : []], ['SESSION'] ? $_SESSION : []);
try {
switch ($_SERVER['REQUEST_METHOD']) {
case 'GET':
array_push(static::$request, ["GET" => $_GET ? $_GET : []]);
break;
case 'POST':
!empty($_GET) ?: array_push(static::$request, ["GET" => $_GET ? $_GET : []]);
!empty($_POST) ?: array_push(static::$request, ["POST" => $_POST ? $_POST : []]);
break;
}
} catch (\Exception $e) {
//дописать логер
}
return static::$request;
}
示例15: run
public function run()
{
$this->beforeRun();
static::$response = new Response();
static::$response->init();
static::$request = new Request();
try {
$this->initComponents();
$this->router();
} catch (HttpException $exception) {
if (ob_get_level() > 0) {
ob_end_clean();
}
static::$response->setStatusCode($exception->statusCode);
ob_start();
require Url::to($this->getErrorView($exception->statusCode));
$content = ob_get_contents();
ob_end_clean();
static::$response->data = $content;
} catch (GboxException $exception) {
if (ob_get_level() > 0) {
ob_end_clean();
}
static::$response->setStatusCode(500);
ob_start();
require Url::to($this->getErrorView(500));
$content = ob_get_contents();
ob_end_clean();
static::$response->data = $content;
} catch (Exception $exception) {
if (ob_get_level() > 0) {
ob_end_clean();
}
static::$response->setStatusCode(500);
ob_start();
require Url::to($this->getErrorView(500));
$content = ob_get_contents();
ob_end_clean();
static::$response->data = $content;
}
static::$response->send();
$this->afterRun();
}