framework/console/CConsoleCommand.php
protected function resolveRequest($args)
	{
		$options=array();	// named parameters
		$params=array();	// unnamed parameters
		foreach($args as $arg)
		{
			if(preg_match('/^--(\w+)(=(.*))?$/',$arg,$matches))  // an option
			{
				$name=$matches[1];
				$value=isset($matches[3]) ? $matches[3] : true;
				if(isset($options[$name]))
				{
					if(!is_array($options[$name]))
						$options[$name]=array($options[$name]);
					$options[$name][]=$value;
				}
				else
					$options[$name]=$value;
			}
			elseif(isset($action))
				$params[]=$arg;
			else
				$action=$arg;
		}
		if(!isset($action))
			$action=$this->defaultAction;

		return array($action,$options,$params);
	}
protected function resolveRequest($args)
	{
		$options=array();	// named parameters
		$params=array();	// unnamed parameters
		foreach($args as $arg)
		{
			if(preg_match('/^--(\w+)(=(.*))?$/',$arg,$matches))  // an option
			{
				$name=$matches[1];
				$value=isset($matches[3]) ? $matches[3] : true;
				if(isset($options[$name]))
				{
					if(!is_array($options[$name]))
						$options[$name]=array($options[$name]);
					$options[$name][]=$value;
				}
				else
					$options[$name]=$value;
			}
			elseif(isset($action))
				$params[]=$arg;
			else
				$action=$arg;
		}
		if(!isset($action))
			$action=$this->defaultAction;

		return array($action,$options,$params);
	}
protected function resolveRequest ( $ args ) { $ options = array ( ) ; // named parameters $ params = array ( ) ; // unnamed parameters foreach ( $ args as $ arg ) { if ( preg_match ( '/^--(\w+)(=(.*))?$/' , $ arg , $ matches ) ) // an option { $ name = $ matches [ 1 ] ; $ value = isset ( $ matches [ 3 ] ) ? $ matches [ 3 ] : true ; if ( isset ( $ options [ $ name ] ) ) { if ( ! is_array ( $ options [ $ name ] ) ) $ options [ $ name ] = array ( $ options [ $ name ] ) ; $ options [ $ name ] [ ] = $ value ; } else $ options [ $ name ] = $ value ; } elseif ( isset ( $ action ) ) $ params [ ] = $ arg ; else $ action = $ arg ; } if ( ! isset ( $ action ) ) $ action = $ this -> defaultAction ; return array ( $ action , $ options , $ params ) ; }
Parses the command line arguments and determines which action to perform.
@param array $args command line arguments
@return array the action name, named options (name=>value), and unnamed options
@since 1.1.5
Parses the command line arguments and determines which action to perform .