@param string $pattern
@param array  ...$args

@return $this
343668
protected function writeln($pattern = null, ...$args)
    {
        if (!$this->hasOutput()) {
            return $this;
        }

        $this->getOutput()->writeln(vsprintf($pattern, $args));

        return $this;
    }
401494
public function matches($pattern)
    {
        $this->isString();

        $this->doCheck(function ($value) use ($pattern) {
            $this->throwExceptionIfFalse(
                preg_match($pattern, $value),
                'String "%s" does not match "%s"', $value, $pattern
            );
        });

        return $this;
    }
670118
public function any(string $pattern, $callable): MethodsInterface
    {
        // Set new route with all methods
        $this->set(self::METHODS, [$pattern, $callable]);

        return $this;
    }
438431
function regexp($pattern, $flags = null) {
        $regexp['pattern'] = $pattern;
        if ($flags) $regexp['flags'] = $flags;
        $this->data['regexp'] = $regexp;
        return $this;
    }
894178
private function addNameAndPattern($name, $pattern)
    {
        $this->arguments[] = $name;
        if ($pattern !== null) {
            $this->arguments[] = $pattern;
        }
    }
528026
private function getArgs(&$pattern, $payload) {
        $args = null;
        // if command has argument
        if (preg_match('/<<.*>>/', $pattern, $matches)) {

            $args_pattern = $matches[0];
            //remove << and >> from patterns
            $tmp_args_pattern = str_replace(['<<', '>>'], ['(', ')'], $pattern);

            //if args set
            if (preg_match('/' . $tmp_args_pattern . '/i', $payload, $matches)) {
                //remove first element
                array_shift($matches);
                if (isset($matches[0])) {
                    //set args
                    $args = array_shift($matches);

                    //remove args pattern from main pattern
                    $pattern = str_replace($args_pattern, '', $pattern);
                }
            }
        }
        return $args;
    }
1072181
public function any($pattern, $action)
    {
        self::$rules[self::REQUEST_METHOD_ANY . self::patternFactory($pattern)] = $action;
        return $this;
    }
196280
public function map(array $methods, string $pattern, $callable): MethodsInterface
    {
        // Check if method in allowed list
        $methods = $this->checkMethods($methods);

        // Set new route with parameters
        $this->set($methods, [$pattern, $callable]);

        return $this;
    }
760217
public static function format($format, ...$args): self
    {
        Assert::typeOf(['string', __CLASS__], $format);

        return new static(sprintf((string) $format, ...$args));
    }
1055744
public function match($pattern) {
        if (!$this->_isValid) {
            return $this;
        }
        if (!preg_match($pattern, $this->_unsafeVar)) {
            $this->_isValid = false;
        }
        return $this;
    }
869855
public function mock($pattern, $ifNotExist = false)
    {
        if ($ifNotExist) {
            $this->_optionalMockPatterns[] = $pattern;
        } else {
            $this->_mockPatterns[] = $pattern;
        }

        return $this;
    }
526549
protected function regexifyPattern($pattern)
    {
        preg_match_all('/(\/?)\(:([^)]*)\)(\??)/', $pattern, $regExPatterns, PREG_SET_ORDER, 0);

        $pattern = preg_quote($pattern, '/');

        foreach ($regExPatterns as $regExPattern) {
            if (!empty($regExPattern[2]) && key_exists($regExPattern[2], $this->patterns)) {
                $replacement = sprintf(
                    '(%s%s)%s',
                    empty($regExPattern[1]) ? '' : '\/',
                    $this->patterns[$regExPattern[2]],
                    $regExPattern[3]
                );

                $pattern     = str_replace(preg_quote($regExPattern[0], '/'), $replacement, $pattern);
            }
        }

        return "/^$pattern$/";
    }
396928
public function where(...$args): self
    {
        $this->createToken('AND', $args, $this->whereTokens, $this->whereWrapper());

        return $this;
    }
577713
public function command($pattern) {
        if (!isset($this->commandSchemas[$pattern])) {
            $this->commandSchemas[$pattern] = [Cli::META => []];
        }
        $this->currentSchema =& $this->commandSchemas[$pattern];

        return $this;
    }
490085
public function match($pattern, array $patterns = []) {
        return $this->matcher->match(
            $this->addLeadingSlash($pattern), $this->getPath(), $patterns
        );
    }
1038975
public function setPattern($pattern)
    {
        if (!is_array($pattern) && !is_string($pattern)) {
            throw new Exception\InvalidArgumentException(sprintf(
                '%s expects pattern to be array or string; received "%s"',
                __METHOD__,
                (is_object($pattern) ? get_class($pattern) : gettype($pattern))
            ));
        }

        if (is_array($pattern)) {
            foreach ($pattern as $p) {
                $this->validatePattern($p);
            }
        }

        if (is_string($pattern)) {
            $this->validatePattern($pattern);
        }

        $this->options['pattern'] = $pattern;
        return $this;
    }
1074304
public function put(string $pattern, $callback, array $requirements = [])
    {
        return $this->match($pattern, $callback, $requirements, [Request::METHOD_PUT]);
    }