public function get($timeout = null, $nullOnTimeout = false)
    {
        $startTime = microtime(true);
        while ($this->getPending()) {
            // return the next result
            if ($this->hasResult()) {
                return $this->getResult();
            }

            // wait for the next result
            $ready = $this->wait($timeout);
            if (is_array($ready)) {
                foreach ($ready as $socket) {
                    $res = self::socket_fetch($socket);
                    if ($res !== null) {
                        $this->results[] = $res;
                        $this->count++;
                    }
                }
                if ($this->hasResult()) {
                    return $this->getResult();
                }
            }

            // timed out?
            if ($timeout and microtime(true) - $startTime > $timeout) {
                if ($nullOnTimeout) {
                    return null;
                }
                throw new ProcessPoolException("Timeout");
            }
        }
    }
public function get($timeout = null, $nullOnTimeout = false)
    {
        $startTime = microtime(true);
        while ($this->getPending()) {
            // return the next result
            if ($this->hasResult()) {
                return $this->getResult();
            }

            // wait for the next result
            $ready = $this->wait($timeout);
            if (is_array($ready)) {
                foreach ($ready as $socket) {
                    $res = self::socket_fetch($socket);
                    if ($res !== null) {
                        $this->results[] = $res;
                        $this->count++;
                    }
                }
                if ($this->hasResult()) {
                    return $this->getResult();
                }
            }

            // timed out?
            if ($timeout and microtime(true) - $startTime > $timeout) {
                if ($nullOnTimeout) {
                    return null;
                }
                throw new ProcessPoolException("Timeout");
            }
        }
    }
public function get ( $ timeout = null , $ nullOnTimeout = false ) { $ startTime = microtime ( true ) ; while ( $ this -> getPending ( ) ) { // return the next result if ( $ this -> hasResult ( ) ) { return $ this -> getResult ( ) ; } // wait for the next result $ ready = $ this -> wait ( $ timeout ) ; if ( is_array ( $ ready ) ) { foreach ( $ ready as $ socket ) { $ res = self :: socket_fetch ( $ socket ) ; if ( $ res !== null ) { $ this -> results [ ] = $ res ; $ this -> count ++ ; } } if ( $ this -> hasResult ( ) ) { return $ this -> getResult ( ) ; } } // timed out? if ( $ timeout and microtime ( true ) - $ startTime > $ timeout ) { if ( $ nullOnTimeout ) { return null ; } throw new ProcessPoolException ( "Timeout" ) ; } } }
Return the next available result.

Blocks unless a $timeout is specified.

@param integer $timeout Timeout in fractional seconds if no results are available.
@return mixed Returns next child response or null on timeout
@throws ProcessPoolException On timeout if $nullOnTimeout is false
Return the next available result .