src/ProcessPoolProcess.php
/**
	 * Wait for a number followed by an exd character
	 *
	 * @return int Number
	 * @throws ProcessPoolException
	 */
Wait for a number followed by an exd character
@return int Number
@throws ProcessPoolException
Wait for a number followed by an exd character @return int Number @throws ProcessPoolException
private function _waitForNumberWithEndChar(string $char)
	{
		while (true)
		{
			if ($this->inputBuffer !== '')
			{
				$pos = strpos($this->inputBuffer, $char);
				if ($pos !== false)
				{
					$msgTypePart = substr($this->inputBuffer, 0, $pos);
					$this->inputBuffer = substr($this->inputBuffer, $pos + 1);
					if (!preg_match('/^[0-9]+$/AD', $msgTypePart))
						throw new ProcessPoolUnexpectedMessageException();
					return (int)$msgTypePart;
				}
				else if (!preg_match('/^[0-9]*$/AD', $this->inputBuffer))
					throw new ProcessPoolUnexpectedMessageException();
			}
			$input = fread(STDIN, 1024);
			if ($input === false || ($input === '' && feof(STDIN)))
				throw new ProcessPoolUnexpectedEOFException();
			$this->inputBuffer .= $input;
		}
	}
private function _waitForNumberWithEndChar ( string $ char ) { while ( true ) { if ( $ this -> inputBuffer !== '' ) { $ pos = strpos ( $ this -> inputBuffer , $ char ) ; if ( $ pos !== false ) { $ msgTypePart = substr ( $ this -> inputBuffer , 0 , $ pos ) ; $ this -> inputBuffer = substr ( $ this -> inputBuffer , $ pos + 1 ) ; if ( ! preg_match ( '/^[0-9]+$/AD' , $ msgTypePart ) ) throw new ProcessPoolUnexpectedMessageException ( ) ; return ( int ) $ msgTypePart ; } else if ( ! preg_match ( '/^[0-9]*$/AD' , $ this -> inputBuffer ) ) throw new ProcessPoolUnexpectedMessageException ( ) ; } $ input = fread ( STDIN , 1024 ) ; if ( $ input === false || ( $ input === '' && feof ( STDIN ) ) ) throw new ProcessPoolUnexpectedEOFException ( ) ; $ this -> inputBuffer .= $ input ; } }
Wait for a number followed by an exd character
 @return int Number
 @throws ProcessPoolException
Wait for a number followed by an exd character @return int Number @throws ProcessPoolException
// Do we have a message type // Message should start with a number // Get more input