public function validateArguments($methods, $handler): array
    {
        if (!$methods || !$handler) {
            throw new \InvalidArgumentException('The method and route handler is not allow empty.');
        }

        $allow = self::ALLOWED_METHODS_STR . ',';
        $hasAny = false;

        $methods = \array_map(function ($m) use ($allow, &$hasAny) {
            $m = \strtoupper(trim($m));

            if (!$m || false === \strpos($allow, $m . ',')) {
                throw new \InvalidArgumentException("The method [$m] is not supported, Allow: " . trim($allow, ','));
            }

            if (!$hasAny && $m === self::ANY) {
                $hasAny = true;
            }

            return $m;
        }, (array)$methods);

        return $hasAny ? self::ALLOWED_METHODS : $methods;
    }
public function validateArguments($methods, $handler): array
    {
        if (!$methods || !$handler) {
            throw new \InvalidArgumentException('The method and route handler is not allow empty.');
        }

        $allow = self::ALLOWED_METHODS_STR . ',';
        $hasAny = false;

        $methods = \array_map(function ($m) use ($allow, &$hasAny) {
            $m = \strtoupper(trim($m));

            if (!$m || false === \strpos($allow, $m . ',')) {
                throw new \InvalidArgumentException("The method [$m] is not supported, Allow: " . trim($allow, ','));
            }

            if (!$hasAny && $m === self::ANY) {
                $hasAny = true;
            }

            return $m;
        }, (array)$methods);

        return $hasAny ? self::ALLOWED_METHODS : $methods;
    }
public function validateArguments ( $ methods , $ handler ) : array { if ( ! $ methods || ! $ handler ) { throw new \ InvalidArgumentException ( 'The method and route handler is not allow empty.' ) ; } $ allow = self :: ALLOWED_METHODS_STR . ',' ; $ hasAny = false ; $ methods = \ array_map ( function ( $ m ) use ( $ allow , & $ hasAny ) { $ m = \ strtoupper ( trim ( $ m ) ) ; if ( ! $ m || false === \ strpos ( $ allow , $ m . ',' ) ) { throw new \ InvalidArgumentException ( "The method [$m] is not supported, Allow: " . trim ( $ allow , ',' ) ) ; } if ( ! $ hasAny && $ m === self :: ANY ) { $ hasAny = true ; } return $ m ; } , ( array ) $ methods ) ; return $ hasAny ? self :: ALLOWED_METHODS : $ methods ; }
validate and format arguments
@param string|array $methods
@param mixed $handler
@return array
@throws \InvalidArgumentException
validate and format arguments