public function onGuzzleHttpCommand(GuzzleHttpEvent $event)
    {
        $request = $event->getRequest();
        $response = $event->getResponse();
        $statusCode = $response->getStatusCode();

        if ($statusCode > 499) {
            $this->data['guzzleHttp']['has5x'] = true;
        }

        if ($statusCode > 399 && $statusCode < 500) {
            $this->data['guzzleHttp']['has4x'] = true;
        }

        $data = [
            'uri' => $request->getUri(),
            'method' => $request->getMethod(),
            'responseCode' => $statusCode,
            'responseReason' => $response->getReasonPhrase(),
            'executionTime' => $event->getExecutionTime(),
            'curl' => [
                'redirectCount' => (isset($response->curlInfo['redirect_count'])) ? $response->curlInfo['redirect_count'] : 0,
                'redirectTime' => (isset($response->curlInfo['redirect_time'])) ? $response->curlInfo['redirect_time'] : 0,
            ],
            'cache' => (isset($response->cached)) ? 1 : 0,
            'cacheTtl' => (isset($response->cacheTtl)) ? $response->cacheTtl : 0,
        ];

        $this->data['guzzleHttp']['commands']->enqueue($data);
    }
public function onGuzzleHttpCommand(GuzzleHttpEvent $event)
    {
        $request = $event->getRequest();
        $response = $event->getResponse();
        $statusCode = $response->getStatusCode();

        if ($statusCode > 499) {
            $this->data['guzzleHttp']['has5x'] = true;
        }

        if ($statusCode > 399 && $statusCode < 500) {
            $this->data['guzzleHttp']['has4x'] = true;
        }

        $data = [
            'uri' => $request->getUri(),
            'method' => $request->getMethod(),
            'responseCode' => $statusCode,
            'responseReason' => $response->getReasonPhrase(),
            'executionTime' => $event->getExecutionTime(),
            'curl' => [
                'redirectCount' => (isset($response->curlInfo['redirect_count'])) ? $response->curlInfo['redirect_count'] : 0,
                'redirectTime' => (isset($response->curlInfo['redirect_time'])) ? $response->curlInfo['redirect_time'] : 0,
            ],
            'cache' => (isset($response->cached)) ? 1 : 0,
            'cacheTtl' => (isset($response->cacheTtl)) ? $response->cacheTtl : 0,
        ];

        $this->data['guzzleHttp']['commands']->enqueue($data);
    }
public function onGuzzleHttpCommand ( GuzzleHttpEvent $ event ) { $ request = $ event -> getRequest ( ) ; $ response = $ event -> getResponse ( ) ; $ statusCode = $ response -> getStatusCode ( ) ; if ( $ statusCode > 499 ) { $ this -> data [ 'guzzleHttp' ] [ 'has5x' ] = true ; } if ( $ statusCode > 399 && $ statusCode < 500 ) { $ this -> data [ 'guzzleHttp' ] [ 'has4x' ] = true ; } $ data = [ 'uri' => $ request -> getUri ( ) , 'method' => $ request -> getMethod ( ) , 'responseCode' => $ statusCode , 'responseReason' => $ response -> getReasonPhrase ( ) , 'executionTime' => $ event -> getExecutionTime ( ) , 'curl' => [ 'redirectCount' => ( isset ( $ response -> curlInfo [ 'redirect_count' ] ) ) ? $ response -> curlInfo [ 'redirect_count' ] : 0 , 'redirectTime' => ( isset ( $ response -> curlInfo [ 'redirect_time' ] ) ) ? $ response -> curlInfo [ 'redirect_time' ] : 0 , ] , 'cache' => ( isset ( $ response -> cached ) ) ? 1 : 0 , 'cacheTtl' => ( isset ( $ response -> cacheTtl ) ) ? $ response -> cacheTtl : 0 , ] ; $ this -> data [ 'guzzleHttp' ] [ 'commands' ] -> enqueue ( $ data ) ; }
Collect data for GuzzleHttp

@param GuzzleHttpEvent $event
Collect data for GuzzleHttp