original_string: 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);
          }
      }
code: 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);
          }
      }
code_tokens: 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 ) ; } }
docstring: when request successed this method will be called
  @param mixed $response
  @param int $index
  @throws \Exception
docstring_tokens: when request successed this method will be called