本文整理匯總了PHP中Composer\Script\CommandEvent::getArguments方法的典型用法代碼示例。如果您正苦於以下問題:PHP CommandEvent::getArguments方法的具體用法?PHP CommandEvent::getArguments怎麽用?PHP CommandEvent::getArguments使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Composer\Script\CommandEvent
的用法示例。
在下文中一共展示了CommandEvent::getArguments方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: initArguments
/**
* Retrieve arguments from global to prepare them for further use.
*
* @param CommandEvent $event The Composer event fired to retrieve arguments from
*
* @author Benjamin Carl <opensource@clickalicious.de>
* @return boolean|null TRUE on success, otherwise FALSE
* @access protected
* @static
*/
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();
}
}