public function parse()
	{
		if (isset($this->raw) && count($this->raw) > 0)
		{
			$class = isset($this->raw[1]) ? $this->raw[1] : 'help';
			$task  = (isset($this->raw[2]) && substr($this->raw[2], 0, 1) != "-") ? $this->raw[2] : 'execute';

			$this->class = self::routeCommand($class);
			$this->task  = self::routeTask($class, $this->class, $task);

			// Parse the remaining args for command options/arguments
			for ($i = 2; $i < count($this->raw); $i++)
			{
				// Ignore the second arg if we used it above as task
				if ($i == 2 && substr($this->raw[$i], 0, 1) != "-")
				{
					continue;
				}

				// Args with an "=" will use the value before as key and the value after as value
				if (strpos($this->raw[$i], "=") !== false)
				{
					$parts = explode("=", $this->raw[$i], 2);
					$key   = preg_replace("/^([-]{1,2})/", "", $parts[0]);
					$value = ($parts[1]);

					if (isset($this->opts[$key]))
					{
						$this->opts[$key] = (array)$this->opts[$key];
						array_push($this->opts[$key], $value);
					}
					else
					{
						$this->opts[$key] = $value;
					}

					continue;
				}
				// Args with a dash but no equals sign will be considered TRUE if present
				elseif (substr($this->raw[$i], 0, 1) == '-')
				{
					// Try to catch clumped arguments (ex: -if as shorthand for -i -f)
					if (preg_match("/^-([[:alpha:]]{2,})/", $this->raw[$i], $matches))
					{
						if (isset($matches[1]))
						{
							foreach (str_split($matches[1], 1) as $k)
							{
								$this->opts[$k] = true;
							}
						}

						continue;
					}
					else
					{
						$key   = preg_replace("/^([-]{1,2})/", "", $this->raw[$i]);
						$value = true;
					}
				}
				// Otherwise, we'll just save the arg as a single word and individual commands may use them
				else
				{
					$key   = $i;
					$value = $this->raw[$i];
				}

				$this->opts[$key] = $value;
			}
		}
	}
public function parse()
	{
		if (isset($this->raw) && count($this->raw) > 0)
		{
			$class = isset($this->raw[1]) ? $this->raw[1] : 'help';
			$task  = (isset($this->raw[2]) && substr($this->raw[2], 0, 1) != "-") ? $this->raw[2] : 'execute';

			$this->class = self::routeCommand($class);
			$this->task  = self::routeTask($class, $this->class, $task);

			// Parse the remaining args for command options/arguments
			for ($i = 2; $i < count($this->raw); $i++)
			{
				// Ignore the second arg if we used it above as task
				if ($i == 2 && substr($this->raw[$i], 0, 1) != "-")
				{
					continue;
				}

				// Args with an "=" will use the value before as key and the value after as value
				if (strpos($this->raw[$i], "=") !== false)
				{
					$parts = explode("=", $this->raw[$i], 2);
					$key   = preg_replace("/^([-]{1,2})/", "", $parts[0]);
					$value = ($parts[1]);

					if (isset($this->opts[$key]))
					{
						$this->opts[$key] = (array)$this->opts[$key];
						array_push($this->opts[$key], $value);
					}
					else
					{
						$this->opts[$key] = $value;
					}

					continue;
				}
				// Args with a dash but no equals sign will be considered TRUE if present
				elseif (substr($this->raw[$i], 0, 1) == '-')
				{
					// Try to catch clumped arguments (ex: -if as shorthand for -i -f)
					if (preg_match("/^-([[:alpha:]]{2,})/", $this->raw[$i], $matches))
					{
						if (isset($matches[1]))
						{
							foreach (str_split($matches[1], 1) as $k)
							{
								$this->opts[$k] = true;
							}
						}

						continue;
					}
					else
					{
						$key   = preg_replace("/^([-]{1,2})/", "", $this->raw[$i]);
						$value = true;
					}
				}
				// Otherwise, we'll just save the arg as a single word and individual commands may use them
				else
				{
					$key   = $i;
					$value = $this->raw[$i];
				}

				$this->opts[$key] = $value;
			}
		}
	}
public function parse ( ) { if ( isset ( $ this -> raw ) && count ( $ this -> raw ) > 0 ) { $ class = isset ( $ this -> raw [ 1 ] ) ? $ this -> raw [ 1 ] : 'help' ; $ task = ( isset ( $ this -> raw [ 2 ] ) && substr ( $ this -> raw [ 2 ] , 0 , 1 ) != "-" ) ? $ this -> raw [ 2 ] : 'execute' ; $ this -> class = self :: routeCommand ( $ class ) ; $ this -> task = self :: routeTask ( $ class , $ this -> class , $ task ) ; // Parse the remaining args for command options/arguments for ( $ i = 2 ; $ i < count ( $ this -> raw ) ; $ i ++ ) { // Ignore the second arg if we used it above as task if ( $ i == 2 && substr ( $ this -> raw [ $ i ] , 0 , 1 ) != "-" ) { continue ; } // Args with an "=" will use the value before as key and the value after as value if ( strpos ( $ this -> raw [ $ i ] , "=" ) !== false ) { $ parts = explode ( "=" , $ this -> raw [ $ i ] , 2 ) ; $ key = preg_replace ( "/^([-]{1,2})/" , "" , $ parts [ 0 ] ) ; $ value = ( $ parts [ 1 ] ) ; if ( isset ( $ this -> opts [ $ key ] ) ) { $ this -> opts [ $ key ] = ( array ) $ this -> opts [ $ key ] ; array_push ( $ this -> opts [ $ key ] , $ value ) ; } else { $ this -> opts [ $ key ] = $ value ; } continue ; } // Args with a dash but no equals sign will be considered TRUE if present elseif ( substr ( $ this -> raw [ $ i ] , 0 , 1 ) == '-' ) { // Try to catch clumped arguments (ex: -if as shorthand for -i -f) if ( preg_match ( "/^-([[:alpha:]]{2,})/" , $ this -> raw [ $ i ] , $ matches ) ) { if ( isset ( $ matches [ 1 ] ) ) { foreach ( str_split ( $ matches [ 1 ] , 1 ) as $ k ) { $ this -> opts [ $ k ] = true ; } } continue ; } else { $ key = preg_replace ( "/^([-]{1,2})/" , "" , $ this -> raw [ $ i ] ) ; $ value = true ; } } // Otherwise, we'll just save the arg as a single word and individual commands may use them else { $ key = $ i ; $ value = $ this -> raw [ $ i ] ; } $ this -> opts [ $ key ] = $ value ; } } }
Parse the raw arguments into command, task, and additional options

@return  void
Parse the raw arguments into command task and additional options