mirror of
https://github.com/friendica/friendica
synced 2025-05-09 15:44:10 +02:00
Add HTTP method to App\Arguments
This commit is contained in:
parent
c7f2ba213b
commit
ee2a15d822
2 changed files with 40 additions and 2 deletions
|
@ -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,11 @@ class Arguments
|
|||
return $this->argv;
|
||||
}
|
||||
|
||||
public function getMethod()
|
||||
{
|
||||
return $this->method;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int The count of arguments of this call
|
||||
*/
|
||||
|
@ -199,6 +209,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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue