forked from php-flasher/flasher-laravel
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSessionBag.php
45 lines (37 loc) · 852 Bytes
/
SessionBag.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
/*
* This file is part of the PHPFlasher package.
* (c) Younes KHOUBZA <[email protected]>
*/
namespace Flasher\Laravel\Storage;
use Flasher\Prime\Storage\Bag\BagInterface;
use Illuminate\Session\Store;
final class SessionBag implements BagInterface
{
const ENVELOPES_NAMESPACE = 'flasher::envelopes';
/**
* @var Store
*/
private $session;
/**
* @param Store $session
*/
public function __construct($session)
{
$this->session = $session;
}
/**
* {@inheritdoc}
*/
public function get()
{
return $this->session->get(self::ENVELOPES_NAMESPACE, array()); // @phpstan-ignore-line
}
/**
* {@inheritdoc}
*/
public function set(array $envelopes)
{
$this->session->put(self::ENVELOPES_NAMESPACE, $envelopes);
}
}