From b465bcefa554ec9401635ca72ba90cf16da4e4ea Mon Sep 17 00:00:00 2001 From: Netkas Date: Wed, 7 Dec 2022 18:04:47 -0500 Subject: [PATCH] \ncc\CLI > Main > getArgs() will try to fetch $argv if available https://git.n64.cc/nosial/ncc/-/issues/23 --- src/ncc/CLI/Main.php | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/ncc/CLI/Main.php b/src/ncc/CLI/Main.php index b5de035..1c571f6 100644 --- a/src/ncc/CLI/Main.php +++ b/src/ncc/CLI/Main.php @@ -31,6 +31,7 @@ * * @param $argv * @return void + * @throws RuntimeException */ 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; } @@ -157,7 +170,7 @@ /** * @return void */ - public static function shutdown() + public static function shutdown(): void { Console::outDebug('clearing cache'); RuntimeCache::clearCache();