Phlyty\Route::via PHP Method

via() public method

Additional arguments will be used as additional methods.
public via ( string | array $method ) : Route
$method string | array
return Route
    public function via($method)
    {
        if (is_string($method) && 1 < func_num_args()) {
            $method = func_get_args();
        }
        if (is_string($method)) {
            $method = (array) $method;
        }
        $method = array_map('strtoupper', $method);
        foreach ($method as $test) {
            if (!in_array($test, self::$allowedMethods)) {
                throw new Exception\InvalidMethodException(sprintf('Invalid method "%s" specified; must be one of %s;' . ' if the method is valid, add it using Phlyty\\Route::allowMethod()', $test, implode(', ', static::$allowedMethods)));
            }
            if (!isset($this->methods[$test])) {
                $this->methods[$test] = true;
            }
        }
        return $this;
    }