mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-02-05 03:58:43 +00:00
improve cli argument handling
This commit is contained in:
parent
c1fb9a31dc
commit
e2b842c29d
|
|
@ -111,6 +111,13 @@ final class ConsoleRequest extends RequestAbstract
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function hasData(string $key) : bool
|
||||||
|
{
|
||||||
|
$key = '-' . \mb_strtolower($key);
|
||||||
|
|
||||||
|
return ArrayUtils::hasArg($key, $this->data) > -1;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set request data.
|
* Set request data.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -14,9 +14,7 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace phpOMS\Module;
|
namespace phpOMS\Module;
|
||||||
|
|
||||||
use Modules\Admin\Models\PermissionAbstractMapper;
|
|
||||||
use phpOMS\Application\ApplicationAbstract;
|
use phpOMS\Application\ApplicationAbstract;
|
||||||
use phpOMS\DataStorage\Database\Query\Builder;
|
|
||||||
use phpOMS\Message\RequestAbstract;
|
use phpOMS\Message\RequestAbstract;
|
||||||
use phpOMS\Message\ResponseAbstract;
|
use phpOMS\Message\ResponseAbstract;
|
||||||
use phpOMS\System\MimeType;
|
use phpOMS\System\MimeType;
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,6 @@ namespace phpOMS\Module;
|
||||||
|
|
||||||
use phpOMS\Application\ApplicationAbstract;
|
use phpOMS\Application\ApplicationAbstract;
|
||||||
use phpOMS\Application\ApplicationInfo;
|
use phpOMS\Application\ApplicationInfo;
|
||||||
use phpOMS\DataStorage\Database\DatabasePool;
|
|
||||||
use phpOMS\System\File\Local\Directory;
|
use phpOMS\System\File\Local\Directory;
|
||||||
use phpOMS\System\File\Local\File;
|
use phpOMS\System\File\Local\File;
|
||||||
use phpOMS\System\File\PathException;
|
use phpOMS\System\File\PathException;
|
||||||
|
|
|
||||||
|
|
@ -169,6 +169,9 @@ final class Argument implements UriInterface
|
||||||
|
|
||||||
$uriParts = \explode(' ', $uri);
|
$uriParts = \explode(' ', $uri);
|
||||||
|
|
||||||
|
// Handle no path information only data
|
||||||
|
$uriParts = \stripos($uriParts[0], '-') === 0 ? ['/', $uriParts[0]] : $uriParts;
|
||||||
|
|
||||||
$this->path = \array_shift($uriParts);
|
$this->path = \array_shift($uriParts);
|
||||||
$this->pathElements = \explode('/', \ltrim($this->path, '/'));
|
$this->pathElements = \explode('/', \ltrim($this->path, '/'));
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -292,11 +292,9 @@ final class ArrayUtils
|
||||||
*/
|
*/
|
||||||
public static function hasArg(string $id, array $args) : int
|
public static function hasArg(string $id, array $args) : int
|
||||||
{
|
{
|
||||||
if (($key = \array_search($id, $args)) === false) {
|
return ($key = \array_search($id, $args)) === false
|
||||||
return -1;
|
? -1
|
||||||
}
|
: (int) $key;
|
||||||
|
|
||||||
return (int) $key;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user