-
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Session.php
42 lines (35 loc) · 1.11 KB
/
Session.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
<?php
/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
namespace Flarum\Extend;
use Flarum\Extension\Extension;
use Illuminate\Contracts\Container\Container;
class Session implements ExtenderInterface
{
private $drivers = [];
/**
* Register a new session driver.
*
* A driver can currently be selected by setting `session.driver` in `config.php`.
*
* @param string $name: The name of the driver.
* @param string $driverClass: The ::class attribute of the driver.
* Driver must implement `\Flarum\User\SessionDriverInterface`.
* @return self
*/
public function driver(string $name, string $driverClass): self
{
$this->drivers[$name] = $driverClass;
return $this;
}
public function extend(Container $container, Extension $extension = null)
{
$container->extend('flarum.session.drivers', function ($drivers) {
return array_merge($drivers, $this->drivers);
});
}
}