X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FApp%2FArguments.php;h=4d386fc2551d2c5138e80db4e4fca53872fbcd7d;hb=82e25a7cf79f2ae9d0fe4ce778b7f772833341c1;hp=ef1ed928563ea72665f17138c2776d0c012ea8d9;hpb=e56a53647bd5469551bf4f9ef2df50a5dd16b943;p=friendica.git diff --git a/src/App/Arguments.php b/src/App/Arguments.php index ef1ed92856..4d386fc255 100644 --- a/src/App/Arguments.php +++ b/src/App/Arguments.php @@ -52,14 +52,19 @@ class Arguments * @var int The count of arguments */ private $argc; + /** + * @var string The used HTTP method + */ + private $method; - public function __construct(string $queryString = '', string $command = '', string $moduleName = '', array $argv = [], int $argc = 0) + public function __construct(string $queryString = '', string $command = '', string $moduleName = '', array $argv = [], int $argc = 0, string $method = Router::GET) { $this->queryString = $queryString; $this->command = $command; $this->moduleName = $moduleName; $this->argv = $argv; $this->argc = $argc; + $this->method = $method; } /** @@ -94,6 +99,14 @@ class Arguments return $this->argv; } + /** + * @return string The used HTTP method + */ + public function getMethod() + { + return $this->method; + } + /** * @return int The count of arguments of this call */ @@ -199,6 +212,8 @@ class Arguments $module = "login"; } - return new Arguments($queryString, $command, $module, $argv, $argc); + $httpMethod = in_array($server['REQUEST_METHOD'] ?? '', Router::ALLOWED_METHODS) ? $server['REQUEST_METHOD'] : Router::GET; + + return new Arguments($queryString, $command, $module, $argv, $argc, $httpMethod); } }