]> git.mxchange.org Git - friendica.git/blobdiff - src/App/Arguments.php
Merge pull request #11273 from MrPetovan/task/4639-soapbox-intro-notification
[friendica.git] / src / App / Arguments.php
index 19f8e9212310d8cef413d544a4e1b4d92adf44f9..4d386fc2551d2c5138e80db4e4fca53872fbcd7d 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * @copyright Copyright (C) 2010-2021, the Friendica project
+ * @copyright Copyright (C) 2010-2022, the Friendica project
  *
  * @license GNU AGPL version 3 or any later version
  *
@@ -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);
        }
 }