X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FApp%2FArguments.php;h=ef1ed928563ea72665f17138c2776d0c012ea8d9;hb=e56a53647bd5469551bf4f9ef2df50a5dd16b943;hp=a7cb37f28906319065b4f44333b3fb37277dac65;hpb=befc2af5043a3afde251721c0d27df695db1bb7e;p=friendica.git diff --git a/src/App/Arguments.php b/src/App/Arguments.php index a7cb37f289..ef1ed92856 100644 --- a/src/App/Arguments.php +++ b/src/App/Arguments.php @@ -1,6 +1,6 @@ queryString = $queryString; $this->command = $command; + $this->moduleName = $moduleName; $this->argv = $argv; $this->argc = $argc; } @@ -71,6 +78,14 @@ class Arguments return $this->command; } + /** + * @return string The module name based on the arguments + */ + public function getModuleName(): string + { + return $this->moduleName; + } + /** * @return array All arguments of this call */ @@ -87,6 +102,17 @@ class Arguments return $this->argc; } + public function setArgv(array $argv) + { + $this->argv = $argv; + $this->argc = count($argv); + } + + public function setArgc(int $argc) + { + $this->argc = $argc; + } + /** * Returns the value of a argv key * @todo there are a lot of $a->argv usages in combination with ?? which can be replaced with this method @@ -161,6 +187,18 @@ class Arguments $queryString = $command . ($queryParameters ? '?' . http_build_query($queryParameters) : ''); - return new Arguments($queryString, $command, $argv, $argc); + if ($argc > 0) { + $module = str_replace('.', '_', $argv[0]); + $module = str_replace('-', '_', $module); + } else { + $module = self::DEFAULT_MODULE; + } + + // Compatibility with the Firefox App + if (($module == "users") && ($command == "users/sign_in")) { + $module = "login"; + } + + return new Arguments($queryString, $command, $module, $argv, $argc); } }