Aerys\Router::update PHP Method

update() public method

Here we generate our dispatcher when the server notifies us that it is ready to start (Server::STARTING).
public update ( Server $server ) : Promise
$server Server
return Promise
    public function update(Server $server) : Promise
    {
        switch ($this->state = $server->state()) {
            case Server::STOPPED:
                $this->routeDispatcher = null;
                break;
            case Server::STARTING:
                if (empty($this->routes)) {
                    return new Failure(new \DomainException("Router start failure: no routes registered"));
                }
                $this->routeDispatcher = simpleDispatcher(function ($rc) use($server) {
                    $this->buildRouter($rc, $server);
                });
                break;
        }
        return new Success();
    }