| @@ 28-61 (lines=34) @@ | ||
| 25 | use Rossmitchell\Twofactor\Interfaces\SessionInterface; |
|
| 26 | use Rossmitchell\Twofactor\Traits\SessionTrait; |
|
| 27 | ||
| 28 | class Session implements SessionInterface |
|
| 29 | { |
|
| 30 | use SessionTrait; |
|
| 31 | ||
| 32 | /** |
|
| 33 | * @var Proxy |
|
| 34 | */ |
|
| 35 | private $adminSession; |
|
| 36 | ||
| 37 | /** |
|
| 38 | * Session constructor. |
|
| 39 | * |
|
| 40 | * @param Proxy $adminSession |
|
| 41 | */ |
|
| 42 | public function __construct(Proxy $adminSession) |
|
| 43 | { |
|
| 44 | $this->adminSession = $adminSession; |
|
| 45 | } |
|
| 46 | ||
| 47 | public function getSession() |
|
| 48 | { |
|
| 49 | $session = $this->adminSession; |
|
| 50 | $this->startSession($session); |
|
| 51 | ||
| 52 | return $session; |
|
| 53 | } |
|
| 54 | ||
| 55 | private function startSession(Proxy $session) |
|
| 56 | { |
|
| 57 | if ($session->isSessionExists() === false) { |
|
| 58 | $session->start(); |
|
| 59 | } |
|
| 60 | } |
|
| 61 | } |
|
| 62 | ||
| @@ 28-61 (lines=34) @@ | ||
| 25 | use Rossmitchell\Twofactor\Interfaces\SessionInterface; |
|
| 26 | use Rossmitchell\Twofactor\Traits\SessionTrait; |
|
| 27 | ||
| 28 | class Session implements SessionInterface |
|
| 29 | { |
|
| 30 | use SessionTrait; |
|
| 31 | ||
| 32 | /** |
|
| 33 | * @var Proxy |
|
| 34 | */ |
|
| 35 | private $customerSession; |
|
| 36 | ||
| 37 | /** |
|
| 38 | * Session constructor. |
|
| 39 | * |
|
| 40 | * @param Proxy $customerSession |
|
| 41 | */ |
|
| 42 | public function __construct(Proxy $customerSession) |
|
| 43 | { |
|
| 44 | $this->customerSession = $customerSession; |
|
| 45 | } |
|
| 46 | ||
| 47 | public function getSession() |
|
| 48 | { |
|
| 49 | $session = $this->customerSession; |
|
| 50 | $this->startSession($session); |
|
| 51 | ||
| 52 | return $session; |
|
| 53 | } |
|
| 54 | ||
| 55 | private function startSession(Proxy $session) |
|
| 56 | { |
|
| 57 | if ($session->isSessionExists() === false) { |
|
| 58 | $session->start(); |
|
| 59 | } |
|
| 60 | } |
|
| 61 | } |
|
| 62 | ||