\ncc\CLI > Main > getArgs() will try to fetch $argv if available

https://git.n64.cc/nosial/ncc/-/issues/23
This commit is contained in:
Netkas 2022-12-07 18:04:47 -05:00
parent b9a356fe40
commit b465bcefa5

View file

@ -31,6 +31,7 @@
* *
* @param $argv * @param $argv
* @return void * @return void
* @throws RuntimeException
*/ */
public static function start($argv): void public static function start($argv): void
{ {
@ -137,10 +138,22 @@
} }
/** /**
* @return mixed * @return array
*/ */
public static function getArgs() public static function getArgs(): array
{ {
if (self::$args == null)
{
if(isset($argv))
{
self::$args = Resolver::parseArguments(implode(' ', $argv));
}
else
{
self::$args = [];
}
}
return self::$args; return self::$args;
} }
@ -157,7 +170,7 @@
/** /**
* @return void * @return void
*/ */
public static function shutdown() public static function shutdown(): void
{ {
Console::outDebug('clearing cache'); Console::outDebug('clearing cache');
RuntimeCache::clearCache(); RuntimeCache::clearCache();