1 | <?php |
||
8 | class TenantRegistry { |
||
9 | /** |
||
10 | * @var Tenant[] |
||
11 | */ |
||
12 | private $tenants = []; |
||
13 | |||
14 | /** |
||
15 | * @var Tenant |
||
16 | */ |
||
17 | private $current; |
||
18 | |||
19 | /** |
||
20 | * @param Tenant[] $tenants |
||
21 | */ |
||
22 | public function __construct( array $tenants = array() ) { |
||
25 | |||
26 | /** |
||
27 | * @param Tenant|string $tenant |
||
28 | * @return bool |
||
29 | */ |
||
30 | public function contains($tenant) { |
||
37 | |||
38 | /** |
||
39 | * @param Tenant[] $tenants |
||
40 | * @return $this |
||
41 | */ |
||
42 | public function addAll(array $tenants) { |
||
53 | |||
54 | /** |
||
55 | * @param Tenant $tenant |
||
56 | * @return $this |
||
57 | */ |
||
58 | public function add(Tenant $tenant) { |
||
65 | |||
66 | /** |
||
67 | * Get a tenant based on their key |
||
68 | * @param string $key The tenant key |
||
69 | * @return Tenant |
||
70 | */ |
||
71 | public function get($key) { |
||
78 | |||
79 | /** |
||
80 | * Gets all tenants |
||
81 | * @return Model\Tenant[] |
||
82 | */ |
||
83 | public function getAll() { |
||
86 | |||
87 | /** |
||
88 | * Gets current |
||
89 | * @return Tenant |
||
90 | */ |
||
91 | public function getCurrent() |
||
95 | |||
96 | /** |
||
97 | * Sets current |
||
98 | * @param Tenant|string $current The current tenant or their key |
||
99 | * @return $this |
||
100 | */ |
||
101 | public function setCurrent( $current ) |
||
111 | } |
||
112 |