src/ProcessPoolProcess.php
/**
	 * Wait for a request
	 *
	 * @throws ProcessPoolException
	 */
Wait for a request
@throws ProcessPoolException
Wait for a request @throws ProcessPoolException
private function waitForRequest()
	{
		ob_start();
		$msgType = $this->_waitForNumberWithEndChar(';');
		if ($msgType === ProcessPoolMessageTypes::MSG_START_REQUEST)
		{
			$length = $this->_waitForNumberWithEndChar(PHP_EOL);
			while (strlen($this->inputBuffer) < $length)
			{
				$input = fread(STDIN, 1024);
				if ($input === false)
					throw new ProcessPoolUnexpectedEOFException();
				$this->inputBuffer .= $input;
			}
			$data = substr($this->inputBuffer, 0, $length);
			$this->inputBuffer = substr($this->inputBuffer, $length);
			try {
				$this->handler->handleRequest($data);
			} catch (Throwable $e) {
				throw new ProcessPoolException('Failed to handle request.', 0, $e);
			}
		}
		else if ($msgType === ProcessPoolMessageTypes::MSG_EXIT)
			$this->handler->handleExit();
	}
private function waitForRequest ( ) { ob_start ( ) ; $ msgType = $ this -> _waitForNumberWithEndChar ( ';' ) ; if ( $ msgType === ProcessPoolMessageTypes :: MSG_START_REQUEST ) { $ length = $ this -> _waitForNumberWithEndChar ( PHP_EOL ) ; while ( strlen ( $ this -> inputBuffer ) < $ length ) { $ input = fread ( STDIN , 1024 ) ; if ( $ input === false ) throw new ProcessPoolUnexpectedEOFException ( ) ; $ this -> inputBuffer .= $ input ; } $ data = substr ( $ this -> inputBuffer , 0 , $ length ) ; $ this -> inputBuffer = substr ( $ this -> inputBuffer , $ length ) ; try { $ this -> handler -> handleRequest ( $ data ) ; } catch ( Throwable $ e ) { throw new ProcessPoolException ( 'Failed to handle request.' , 0 , $ e ) ; } } else if ( $ msgType === ProcessPoolMessageTypes :: MSG_EXIT ) $ this -> handler -> handleExit ( ) ; }
Wait for a request
 @throws ProcessPoolException
Wait for a request @throws ProcessPoolException
// Get message type // Process message type // Handle request