protected function getParameters(RequestInterface $request, ResponseInterface $response = null)
    {
        $params = [];
        $result = '';

        $keys = array_intersect($this->context, $this->availableParameters);

        foreach ($keys as $key) {
            switch ($key) {
                case 'method':
                    $result = $request->getMethod();
                    break;
                case 'url':
                    $result = $request->getUri()->__toString();
                    break;
                case 'request_version':
                    $result = $request->getProtocolVersion();
                    break;
                case 'response_version':
                    $result = $response ? $response->getProtocolVersion() : 'NULL';
                    break;
                case 'host':
                    $result = $request->getUri()->getHost();
                    break;
                case 'hostname':
                    $result = gethostname();
                    break;
                case 'status_code':
                    $result = $response ? $response->getStatusCode() : 'NULL';
                    break;
                case 'phrase':
                    $result = $response ? $response->getReasonPhrase() : 'NULL';
                    break;
            }

            $params[$key] = (string) $result ?: '';
        }

        return $params;
    }
protected function getParameters(RequestInterface $request, ResponseInterface $response = null)
    {
        $params = [];
        $result = '';

        $keys = array_intersect($this->context, $this->availableParameters);

        foreach ($keys as $key) {
            switch ($key) {
                case 'method':
                    $result = $request->getMethod();
                    break;
                case 'url':
                    $result = $request->getUri()->__toString();
                    break;
                case 'request_version':
                    $result = $request->getProtocolVersion();
                    break;
                case 'response_version':
                    $result = $response ? $response->getProtocolVersion() : 'NULL';
                    break;
                case 'host':
                    $result = $request->getUri()->getHost();
                    break;
                case 'hostname':
                    $result = gethostname();
                    break;
                case 'status_code':
                    $result = $response ? $response->getStatusCode() : 'NULL';
                    break;
                case 'phrase':
                    $result = $response ? $response->getReasonPhrase() : 'NULL';
                    break;
            }

            $params[$key] = (string) $result ?: '';
        }

        return $params;
    }
protected function getParameters ( RequestInterface $ request , ResponseInterface $ response = null ) { $ params = [ ] ; $ result = '' ; $ keys = array_intersect ( $ this -> context , $ this -> availableParameters ) ; foreach ( $ keys as $ key ) { switch ( $ key ) { case 'method' : $ result = $ request -> getMethod ( ) ; break ; case 'url' : $ result = $ request -> getUri ( ) -> __toString ( ) ; break ; case 'request_version' : $ result = $ request -> getProtocolVersion ( ) ; break ; case 'response_version' : $ result = $ response ? $ response -> getProtocolVersion ( ) : 'NULL' ; break ; case 'host' : $ result = $ request -> getUri ( ) -> getHost ( ) ; break ; case 'hostname' : $ result = gethostname ( ) ; break ; case 'status_code' : $ result = $ response ? $ response -> getStatusCode ( ) : 'NULL' ; break ; case 'phrase' : $ result = $ response ? $ response -> getReasonPhrase ( ) : 'NULL' ; break ; } $ params [ $ key ] = ( string ) $ result ? : '' ; } return $ params ; }
Get context fields to add to the time-line entry.

@param \Psr\Http\Message\RequestInterface $request
@param \Psr\Http\Message\ResponseInterface $response

@return array
Get context fields to add to the time - line entry .