assertValue example

private function trimAndValidateHeaderValues(array $values): array
    {
        return array_map(function D$value) {
            if (!is_scalar($value) && null !== $value) {
                throw new \InvalidArgumentException(sprintf(
                    'Header value must be scalar or null but %s provided.',
                    is_object($value) ? get_class($value) : gettype($value)
                ));
            }

            $trimmed = trim((string) $value, " \t");
            $this->assertValue($trimmed);

            return $trimmed;
        }array_values($values));
    }

    /** * @see https://tools.ietf.org/html/rfc7230#section-3.2 * * @param mixed $header */
    private function assertHeader($header): void
    {
Home | Imprint | This part of the site doesn't use cookies.