src/CLI/Command/ArgumentParser.php
public function parse( $string )
	{
		if( !is_string( $string ) )														//  no String given
			throw new InvalidArgumentException( 'Given argument is not a string' );		//  throw Exception

		$this->extendPossibleOptionsWithShortcuts();									//  realize Shortcuts

		$position	= 0;																//  initiate Sign Pointer
		$status		= self::STATUS_START;												//  initiate Status
		$buffer		= "";																//  initiate Argument Buffer
		$option		= "";																//  initiate Option Buffer

		while( isset( $string[$position] ) )											//  loop until End of String
		{
			$sign	= $string[$position];												//  get current Sign
			$position ++;																//  increase Sign Pointer

			switch( $status )															//  handle Sign depending on Status
			{
				case self::STATUS_START:												//  open for all Signs
					$this->onReady( $sign, $status, $buffer, $option );					//  handle Sign
					break;
				case self::STATUS_READ_OPTION_KEY:										//  open for Option Key Signs
					$this->onReadOptionKey( $sign, $status, $buffer, $option );			//  handle Sign
					break;
				case self::STATUS_READ_OPTION_VALUE:									//  open for Option Value Signs
					$this->onReadOptionValue( $sign, $status, $buffer, $option );		//  handle Sign
					break;
				case self::STATUS_READ_ARGUMENT:										//  open for Argument Signs
					$this->onReadArgument( $sign, $status, $buffer );					//  handle Sign
					break;
			}
		}
		$this->onEndOfLine( $status, $buffer, $option );								//  close open States
	}
public function parse( $string )
	{
		if( !is_string( $string ) )														//  no String given
			throw new InvalidArgumentException( 'Given argument is not a string' );		//  throw Exception

		$this->extendPossibleOptionsWithShortcuts();									//  realize Shortcuts

		$position	= 0;																//  initiate Sign Pointer
		$status		= self::STATUS_START;												//  initiate Status
		$buffer		= "";																//  initiate Argument Buffer
		$option		= "";																//  initiate Option Buffer

		while( isset( $string[$position] ) )											//  loop until End of String
		{
			$sign	= $string[$position];												//  get current Sign
			$position ++;																//  increase Sign Pointer

			switch( $status )															//  handle Sign depending on Status
			{
				case self::STATUS_START:												//  open for all Signs
					$this->onReady( $sign, $status, $buffer, $option );					//  handle Sign
					break;
				case self::STATUS_READ_OPTION_KEY:										//  open for Option Key Signs
					$this->onReadOptionKey( $sign, $status, $buffer, $option );			//  handle Sign
					break;
				case self::STATUS_READ_OPTION_VALUE:									//  open for Option Value Signs
					$this->onReadOptionValue( $sign, $status, $buffer, $option );		//  handle Sign
					break;
				case self::STATUS_READ_ARGUMENT:										//  open for Argument Signs
					$this->onReadArgument( $sign, $status, $buffer );					//  handle Sign
					break;
			}
		}
		$this->onEndOfLine( $status, $buffer, $option );								//  close open States
	}
public function parse ( $ string ) { if ( ! is_string ( $ string ) ) //  no String given throw new InvalidArgumentException ( 'Given argument is not a string' ) ; //  throw Exception $ this -> extendPossibleOptionsWithShortcuts ( ) ; //  realize Shortcuts $ position = 0 ; //  initiate Sign Pointer $ status = self :: STATUS_START ; //  initiate Status $ buffer = "" ; //  initiate Argument Buffer $ option = "" ; //  initiate Option Buffer while ( isset ( $ string [ $ position ] ) ) //  loop until End of String { $ sign = $ string [ $ position ] ; //  get current Sign $ position ++ ; //  increase Sign Pointer switch ( $ status ) //  handle Sign depending on Status { case self :: STATUS_START : //  open for all Signs $ this -> onReady ( $ sign , $ status , $ buffer , $ option ) ; //  handle Sign break ; case self :: STATUS_READ_OPTION_KEY : //  open for Option Key Signs $ this -> onReadOptionKey ( $ sign , $ status , $ buffer , $ option ) ; //  handle Sign break ; case self :: STATUS_READ_OPTION_VALUE : //  open for Option Value Signs $ this -> onReadOptionValue ( $ sign , $ status , $ buffer , $ option ) ; //  handle Sign break ; case self :: STATUS_READ_ARGUMENT : //  open for Argument Signs $ this -> onReadArgument ( $ sign , $ status , $ buffer ) ; //  handle Sign break ; } } $ this -> onEndOfLine ( $ status , $ buffer , $ option ) ; //  close open States }
Parses given Argument String and extracts Arguments and Options.
@access		public
@param		string		$string		String of Arguments and Options
@return		void
Parses given Argument String and extracts Arguments and Options .