Completed
Push — external_storage_registry ( 06bed8 )
by
unknown
17:52
created

ExternalStorageRegistry   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 30
rs 10
c 0
b 0
f 0
wmc 3
lcom 1
cbo 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A registerExternalStorageHandler() 0 4 1
A getExternalStorageHandlers() 0 4 1
1
<?php
2
3
/**
4
 * File containing the ExternalStorageRegistryFactory class.
5
 *
6
 * @copyright Copyright (C) eZ Systems AS. All rights reserved.
7
 * @license For full copyright and license information view LICENSE file distributed with this source code.
8
 */
9
namespace eZ\Publish\Core\Base\Container\ApiLoader\Storage;
10
11
class ExternalStorageRegistry
12
{
13
    /**
14
     * Collection of external storage handlers for field types that need them.
15
     *
16
     * @var \eZ\Publish\SPI\FieldType\FieldStorage[]
17
     */
18
    protected $externalStorages;
19
20
    /**
21
     * @param \eZ\Publish\SPI\FieldType\FieldStorage[] $externalStorages
22
     */
23
    public function __construct(array $externalStorages)
24
    {
25
        $this->externalStorages = $externalStorages;
26
    }
27
28
    public function registerExternalStorageHandler(string $identifier, $externalStorage): void
29
    {
30
        $this->externalStorages[$identifier] = $externalStorage;
31
    }
32
33
    /**
34
     * @return \eZ\Publish\SPI\FieldType\FieldStorage[]
35
     */
36
    public function getExternalStorageHandlers(): array
37
    {
38
        return $this->externalStorages;
39
    }
40
}
41