src/Router.php
function middleware($names) : self {
        if (!isset($this->_pSet[self::_SIBLINGS])) {
            Console::warning("No route to bind middleware.");
            return $this;
        }
        if (!is_array($names))
            $names = [$names];
        foreach ($this->_pSet[self::_SIBLINGS] as &$pSet) {
            foreach ($names as $name) {
                $callback = Middleware::fetch($name);
                if ($callback) {
                    if (!is_callable($callback)) {
                        Console::warning('Failed to bind middleware. Callback function not callable.');
                        continue;
                    }
                    $this->_toClosure($callback);
                    $pSet[self::_MIDDLEWARE][] = $callback;
                }
            }
        }
        return $this;
    }
function middleware($names) : self {
        if (!isset($this->_pSet[self::_SIBLINGS])) {
            Console::warning("No route to bind middleware.");
            return $this;
        }
        if (!is_array($names))
            $names = [$names];
        foreach ($this->_pSet[self::_SIBLINGS] as &$pSet) {
            foreach ($names as $name) {
                $callback = Middleware::fetch($name);
                if ($callback) {
                    if (!is_callable($callback)) {
                        Console::warning('Failed to bind middleware. Callback function not callable.');
                        continue;
                    }
                    $this->_toClosure($callback);
                    $pSet[self::_MIDDLEWARE][] = $callback;
                }
            }
        }
        return $this;
    }
绑定中间件

@param mixed $names
@return Router