currentUser = $current_user; return $this; } /** * {@inheritdoc} */ public function getTitle() { if ($this->currentUser->isAuthenticated()) { return 'Log out'; } else { return 'Log in'; } } /** * {@inheritdoc} */ public function getRouteName() { if ($this->currentUser->isAuthenticated()) { return 'user.logout'; } else { return 'user.login'; } } /** * {@inheritdoc} */ public function getCacheContexts() { return ['user.roles:authenticated']; } }