mirror of
https://github.com/flarum/core.git
synced 2025-10-17 17:56:14 +02:00
This required some interface changes (mostly changing Laravel's or Symfony's request and response classes to those of Zend's Diactoros. Some smaller changes to the execution flow in a few of the abstract action base classes, but nothing substantial. Note: The request and response classes are immutable, so we usually need to return new instances after modifying the old ones.
34 lines
620 B
PHP
34 lines
620 B
PHP
<?php namespace Flarum\Api;
|
|
|
|
use Flarum\Support\Actor;
|
|
use Psr\Http\Message\ServerRequestInterface;
|
|
|
|
class Request
|
|
{
|
|
public $input;
|
|
|
|
public $actor;
|
|
|
|
/**
|
|
* @var ServerRequestInterface
|
|
*/
|
|
public $http;
|
|
|
|
public function __construct(array $input, Actor $actor = null, ServerRequestInterface $http = null)
|
|
{
|
|
$this->input = $input;
|
|
$this->actor = $actor;
|
|
$this->http = $http;
|
|
}
|
|
|
|
public function get($key, $default = null)
|
|
{
|
|
return array_get($this->input, $key, $default);
|
|
}
|
|
|
|
public function all()
|
|
{
|
|
return $this->input;
|
|
}
|
|
}
|