src/SimpleConcurrent.php
private function _responseSuccessHandle($response, $index)
    {
        try {
            if (! $response instanceof ResponseInterface) throw new UnknowResponseExpection($response);
            $result = $response->getBody()->getContents();
            $cbk = $this->requestList[$index]->getSuccessCallbackList();
            if (! empty($cbk)) {
                $result = array_reduce($cbk, function ($prev, $cb) {
                    return $cb($prev);
                }, $result);
            }
            $response = new SimpleResponse();
            $response->setResult($result);
            $this->requestList[$index]->setResponse($response);
        } catch (\Exception $e) {
            $this->_responseFailHandle($e, $index);
        }
    }
private function _responseSuccessHandle($response, $index)
    {
        try {
            if (! $response instanceof ResponseInterface) throw new UnknowResponseExpection($response);
            $result = $response->getBody()->getContents();
            $cbk = $this->requestList[$index]->getSuccessCallbackList();
            if (! empty($cbk)) {
                $result = array_reduce($cbk, function ($prev, $cb) {
                    return $cb($prev);
                }, $result);
            }
            $response = new SimpleResponse();
            $response->setResult($result);
            $this->requestList[$index]->setResponse($response);
        } catch (\Exception $e) {
            $this->_responseFailHandle($e, $index);
        }
    }
private function _responseSuccessHandle ( $ response , $ index ) { try { if ( ! $ response instanceof ResponseInterface ) throw new UnknowResponseExpection ( $ response ) ; $ result = $ response -> getBody ( ) -> getContents ( ) ; $ cbk = $ this -> requestList [ $ index ] -> getSuccessCallbackList ( ) ; if ( ! empty ( $ cbk ) ) { $ result = array_reduce ( $ cbk , function ( $ prev , $ cb ) { return $ cb ( $ prev ) ; } , $ result ) ; } $ response = new SimpleResponse ( ) ; $ response -> setResult ( $ result ) ; $ this -> requestList [ $ index ] -> setResponse ( $ response ) ; } catch ( \ Exception $ e ) { $ this -> _responseFailHandle ( $ e , $ index ) ; } }
when request successed this method will be called
@param mixed $response
@param int $index
@throws \Exception
when request successed this method will be called