public static function validate(HeaderBag $headers)
    {
        $errors = [];

        foreach (self::$delegates as $delegate => $headerList)
        {
            $class = self::VALIDATOR_NAMESPACE.'\\'.$delegate;

            if ( ! is_array($headerList))
            {
                $headerList = [$headerList];
            }

            foreach ($headerList as $headerName)
            {
                $headers->forEachNamed(
                    $headerName,
                    function (Header $header) use (&$errors, $class)
                    {
                        $errors = array_merge(
                            $errors,
                            $class::validate($header)
                        );
                    }
                );
            }
        }

        return $errors;
    }
public static function validate(HeaderBag $headers)
    {
        $errors = [];

        foreach (self::$delegates as $delegate => $headerList)
        {
            $class = self::VALIDATOR_NAMESPACE.'\\'.$delegate;

            if ( ! is_array($headerList))
            {
                $headerList = [$headerList];
            }

            foreach ($headerList as $headerName)
            {
                $headers->forEachNamed(
                    $headerName,
                    function (Header $header) use (&$errors, $class)
                    {
                        $errors = array_merge(
                            $errors,
                            $class::validate($header)
                        );
                    }
                );
            }
        }

        return $errors;
    }
public static function validate ( HeaderBag $ headers ) { $ errors = [ ] ; foreach ( self :: $ delegates as $ delegate => $ headerList ) { $ class = self :: VALIDATOR_NAMESPACE . '\\' . $ delegate ; if ( ! is_array ( $ headerList ) ) { $ headerList = [ $ headerList ] ; } foreach ( $ headerList as $ headerName ) { $ headers -> forEachNamed ( $ headerName , function ( Header $ header ) use ( & $ errors , $ class ) { $ errors = array_merge ( $ errors , $ class :: validate ( $ header ) ) ; } ) ; } } return $ errors ; }
Validate the given headers

@param HeaderBag $headers

@return Error[]
Validate the given headers