comparison core/lib/Drupal/Core/Session/AccountSwitcherInterface.php @ 0:4c8ae668cc8c

Initial import (non-working)
author Chris Cannam
date Wed, 29 Nov 2017 16:09:58 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:4c8ae668cc8c
1 <?php
2
3 namespace Drupal\Core\Session;
4
5 /**
6 * Defines an interface for a service for safe account switching.
7 *
8 * @ingroup user_api
9 */
10 interface AccountSwitcherInterface {
11
12 /**
13 * Safely switches to another account.
14 *
15 * Each invocation of AccountSwitcherInterface::switchTo() must be
16 * matched by a corresponding invocation of
17 * AccountSwitcherInterface::switchBack() in the same function.
18 *
19 * @param \Drupal\Core\Session\AccountInterface $account
20 * The account to switch to.
21 *
22 * @return \Drupal\Core\Session\AccountSwitcherInterface
23 * $this.
24 */
25 public function switchTo(AccountInterface $account);
26
27 /**
28 * Reverts to a previous account after switching.
29 *
30 * @return \Drupal\Core\Session\AccountSwitcherInterface
31 * $this.
32 *
33 * @throws \RuntimeException
34 * When there are no more account switches to revert.
35 */
36 public function switchBack();
37
38 }