1 | <?php |
||
8 | class CookieLocator implements TenantLocator |
||
9 | { |
||
10 | |||
11 | /** |
||
12 | * @var Request |
||
13 | */ |
||
14 | private $request; |
||
15 | |||
16 | /** |
||
17 | * @var string |
||
18 | */ |
||
19 | private $cookieName; |
||
20 | |||
21 | /** |
||
22 | * @var TenantRegistry |
||
23 | */ |
||
24 | private $tenantRegistry; |
||
25 | |||
26 | /** |
||
27 | * @param Request $request |
||
28 | * @param $cookieName |
||
29 | * @param TenantRegistry $tenantRegistry |
||
30 | */ |
||
31 | public function __construct(Request $request, $cookieName, TenantRegistry $tenantRegistry) |
||
37 | |||
38 | /** |
||
39 | * @return string |
||
40 | */ |
||
41 | public function getTenant() |
||
49 | |||
50 | /** |
||
51 | * @param Request $request |
||
52 | * @param string $cookieName |
||
53 | * @param TenantRegistry $tenantRegistry |
||
54 | * |
||
55 | * @return string Tenant key |
||
56 | */ |
||
57 | public static function getTenantFromRequest( |
||
66 | |||
67 | /** |
||
68 | * @param $tenantName |
||
69 | * |
||
70 | * @return bool |
||
71 | */ |
||
72 | private function tenantNameIsValid($tenantName) |
||
76 | |||
77 | /** |
||
78 | * @throws \RuntimeException |
||
79 | * @throws \OutOfBoundsException |
||
80 | * |
||
81 | * @param $tenantName |
||
82 | */ |
||
83 | private function checkTenantName($tenantName) |
||
95 | } |
||
96 |