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;
    }