private function filterHeaderValue($values): array
    {
        if (! \is_array($values)) {
            $values = [$values];
        }

        if (\count($values) === 0 || ! $this->arrayContainsOnlyStrings($values)) {
            throw new InvalidArgumentException(
                'Invalid header value: must be a string or array of strings and cannot be an empty array.'
            );
        }

        $values = \array_map(static function ($value) {
            // @see http://tools.ietf.org/html/rfc7230#section-3.2
            HeaderSecurity::assertValid($value);

            $value = (string) $value;

            // Spaces and tabs ought to be excluded by parsers when extracting the field value from a header field.
            //
            // header-field = field-name ":" OWS field-value OWS
            // OWS          = *( SP / HTAB )
            //
            // @see https://tools.ietf.org/html/rfc7230#section-3.2.4
            return \trim($value, " \t");
        }, \array_values($values));

        return \array_map([HeaderSecurity::class, 'filter'], \array_values($values));
    }
private function filterHeaderValue($values): array
    {
        if (! \is_array($values)) {
            $values = [$values];
        }

        if (\count($values) === 0 || ! $this->arrayContainsOnlyStrings($values)) {
            throw new InvalidArgumentException(
                'Invalid header value: must be a string or array of strings and cannot be an empty array.'
            );
        }

        $values = \array_map(static function ($value) {
            // @see http://tools.ietf.org/html/rfc7230#section-3.2
            HeaderSecurity::assertValid($value);

            $value = (string) $value;

            // Spaces and tabs ought to be excluded by parsers when extracting the field value from a header field.
            //
            // header-field = field-name ":" OWS field-value OWS
            // OWS          = *( SP / HTAB )
            //
            // @see https://tools.ietf.org/html/rfc7230#section-3.2.4
            return \trim($value, " \t");
        }, \array_values($values));

        return \array_map([HeaderSecurity::class, 'filter'], \array_values($values));
    }
private function filterHeaderValue ( $ values ) : array { if ( ! \ is_array ( $ values ) ) { $ values = [ $ values ] ; } if ( \ count ( $ values ) === 0 || ! $ this -> arrayContainsOnlyStrings ( $ values ) ) { throw new InvalidArgumentException ( 'Invalid header value: must be a string or array of strings and cannot be an empty array.' ) ; } $ values = \ array_map ( static function ( $ value ) { // @see http://tools.ietf.org/html/rfc7230#section-3.2 HeaderSecurity :: assertValid ( $ value ) ; $ value = ( string ) $ value ; // Spaces and tabs ought to be excluded by parsers when extracting the field value from a header field. // // header-field = field-name ":" OWS field-value OWS // OWS          = *( SP / HTAB ) // // @see https://tools.ietf.org/html/rfc7230#section-3.2.4 return \ trim ( $ value , " \t" ) ; } , \ array_values ( $ values ) ) ; return \ array_map ( [ HeaderSecurity :: class , 'filter' ] , \ array_values ( $ values ) ) ; }
Filter array headers.

@param array|string $values

@return array
Filter array headers .