src/Router.php
function bind(array $controllers) : self {
        if (!isset($this->_pSet[self::_SIBLINGS])) {
            Console::warning("No route to bind.");
            return $this;
        }
        if (!is_array($controllers[0]))
            $controllers = [$controllers];
        foreach ($this->_pSet[self::_SIBLINGS] as &$pSet) {
            foreach ($controllers as $controller) {
                $count = count($controller);
                if ($count == 3)
                    [$name, $controller, $method] = $controller;
                elseif ($count == 2) {
                    [$controller, $method] = $controller;
                    $name = count($this->_pSet[self::_CONTROLLER]);
                } else {
                    Console::warning("Invalid controller binding,");
                    continue;
                }
                $controller = Server::$name.'\\Controller\\'.$controller;
                if (!class_exists($controller) || !is_subclass_of($controller, Controller::class)) {
                    Console::warning("Invalid controller \"$controller\".");
                    return $this;
                }
                if (!method_exists($controller, $method)) {
                    Console::warning("Invalid method \"$method\".");
                    return $this;
                }
                if (isset($pSet[self::_CONTROLLER][$name]))
                    Console::warning("Overwriting controller binding \"$name\"");
                $pSet[self::_CONTROLLER][$name] = [$controller, $method];
            }
        }
        return $this;
    }
function bind(array $controllers) : self {
        if (!isset($this->_pSet[self::_SIBLINGS])) {
            Console::warning("No route to bind.");
            return $this;
        }
        if (!is_array($controllers[0]))
            $controllers = [$controllers];
        foreach ($this->_pSet[self::_SIBLINGS] as &$pSet) {
            foreach ($controllers as $controller) {
                $count = count($controller);
                if ($count == 3)
                    [$name, $controller, $method] = $controller;
                elseif ($count == 2) {
                    [$controller, $method] = $controller;
                    $name = count($this->_pSet[self::_CONTROLLER]);
                } else {
                    Console::warning("Invalid controller binding,");
                    continue;
                }
                $controller = Server::$name.'\\Controller\\'.$controller;
                if (!class_exists($controller) || !is_subclass_of($controller, Controller::class)) {
                    Console::warning("Invalid controller \"$controller\".");
                    return $this;
                }
                if (!method_exists($controller, $method)) {
                    Console::warning("Invalid method \"$method\".");
                    return $this;
                }
                if (isset($pSet[self::_CONTROLLER][$name]))
                    Console::warning("Overwriting controller binding \"$name\"");
                $pSet[self::_CONTROLLER][$name] = [$controller, $method];
            }
        }
        return $this;
    }
绑定控制器及其方法

@param array $controllers
@return Router