function __construct(Databases $databases, Route $route) { if (!$route->branchLevelId()) { throw new \RuntimeException('Try to access BranchDb with undefined branch context'); } $this->db = $databases[$route->branchLevelId()]; }
function __invoke(Route $route, Sessions $sessions) { $this->authResponse = $this->logout(); $this->handleAuthResponse(); if ($route->branchLevelId() == $sessions[0]->id) { unset($sessions[0]); } }
protected function getSession(Sessions $sessions, Route $route) { return $sessions[$route->branchLevelId()]; }