Clickalicious\PhpMemAdmin\BaseInstaller::initArguments PHP Method

initArguments() protected static method

Retrieve arguments from global to prepare them for further use.
Author: Benjamin Carl ([email protected])
protected static initArguments ( Composer\Script\CommandEvent $event = null ) : boolean
$event Composer\Script\CommandEvent The Composer event fired to retrieve arguments from
return boolean TRUE on success, otherwise FALSE
    protected static function initArguments(CommandEvent $event = null)
    {
        // Check for retrieving arguments from Composer event ...
        if ($event !== null) {
            $arguments = $event->getArguments();
        } else {
            $arguments = $_SERVER['argv'];
        }
        // Check for strict mode
        $strict = in_array('--strict', $arguments);
        $arguments = new \cli\Arguments(compact('strict'), $arguments);
        $arguments->addFlag(array('verbose', 'v'), 'Turn on verbose output');
        $arguments->addFlag(array('version', 'V'), 'Display the version');
        $arguments->addFlag(array('quiet', 'q'), 'Disable all output');
        $arguments->addFlag(array('help', 'h'), 'Show this help screen');
        // Parse the arguments
        $arguments->parse();
        // Store arguments ...
        self::$arguments = $arguments;
        if (isset(self::$arguments['help']) === true) {
            self::showHelp();
        }
    }