diff --git a/src/Model/Environment.php b/src/Model/Environment.php new file mode 100644 index 0000000..ae78831 --- /dev/null +++ b/src/Model/Environment.php @@ -0,0 +1,34 @@ +[^=]+)=(?.*)$/', $value, $argument)) + { + $this->_argument[mb_strtolower($argument['key'])] = (string) $argument['value']; + } + } + } + + public function get( + string $key + ): ?string + { + $key = mb_strtolower( + $key + ); + + return isset($this->_argument[$key]) ? $this->_argument[$key] + : null; + } +} \ No newline at end of file diff --git a/src/crawler.php b/src/crawler.php index 076fd14..d38b60f 100644 --- a/src/crawler.php +++ b/src/crawler.php @@ -15,12 +15,14 @@ require_once __DIR__ . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php'; -// Init profile argument -if (empty($argv[1])) throw new \Exception; +// Init environment +$environment = new \Yggverse\Pulsar\Model\Environment( + $argv +); // Init config $config = new \Yggverse\Pulsar\Model\Config( - $argv[1] + $environment->get('config') ); $config = $config->get(); // registry only