1 | <?php |
||
21 | class StorageManager extends Component implements StorageInterface, InjectorInterface |
||
22 | { |
||
23 | /** |
||
24 | * @var BucketInterface[] |
||
25 | */ |
||
26 | private $buckets = []; |
||
27 | |||
28 | /** |
||
29 | * @var ServerInterface[] |
||
30 | */ |
||
31 | private $servers = []; |
||
32 | |||
33 | /** |
||
34 | * @var StorageConfig |
||
35 | */ |
||
36 | protected $config; |
||
37 | |||
38 | /** |
||
39 | * @invisible |
||
40 | * |
||
41 | * @var FactoryInterface |
||
42 | */ |
||
43 | protected $factory; |
||
44 | |||
45 | /** |
||
46 | * @param StorageConfig $config |
||
47 | * @param FactoryInterface $factory |
||
48 | */ |
||
49 | public function __construct(StorageConfig $config, FactoryInterface $factory) |
||
60 | |||
61 | /** |
||
62 | * @param BucketInterface $bucket |
||
63 | * |
||
64 | * @return self |
||
65 | * |
||
66 | * @throws StorageException |
||
67 | */ |
||
68 | public function setBucket(BucketInterface $bucket): StorageManager |
||
79 | |||
80 | /** |
||
81 | * {@inheritdoc} |
||
82 | */ |
||
83 | public function registerBucket( |
||
109 | |||
110 | /** |
||
111 | * {@inheritdoc} |
||
112 | */ |
||
113 | public function getBucket(string $bucket): BucketInterface |
||
127 | |||
128 | /** |
||
129 | * Add server. |
||
130 | * |
||
131 | * @param string $name |
||
132 | * @param ServerInterface $server |
||
133 | * |
||
134 | * @return $this |
||
135 | * |
||
136 | * @throws StorageException |
||
137 | */ |
||
138 | public function setServer($name, ServerInterface $server) |
||
150 | |||
151 | /** |
||
152 | * {@inheritdoc} |
||
153 | */ |
||
154 | public function getServer(string $server): ServerInterface |
||
169 | |||
170 | /** |
||
171 | * {@inheritdoc} |
||
172 | */ |
||
173 | public function open(string $address): ObjectInterface |
||
177 | |||
178 | /** |
||
179 | * {@inheritdoc} |
||
180 | */ |
||
181 | public function locateBucket(string $address, string &$name = null): BucketInterface |
||
198 | |||
199 | /** |
||
200 | * {@inheritdoc} |
||
201 | */ |
||
202 | public function put(string $bucket, string $name, $source = ''): ObjectInterface |
||
208 | |||
209 | /** |
||
210 | * {@inheritdoc} |
||
211 | */ |
||
212 | public function createInjection(\ReflectionClass $class, string $context = null) |
||
220 | |||
221 | /** |
||
222 | * Create bucket based configuration settings. |
||
223 | * |
||
224 | * @param string $name |
||
225 | * @param array $bucket |
||
226 | * |
||
227 | * @return StorageBucket |
||
228 | * |
||
229 | * @throws StorageException |
||
230 | */ |
||
231 | private function createBucket(string $name, array $bucket): StorageBucket |
||
255 | } |
||
256 |