Completed
Pull Request — master (#10)
by Tomáš
03:17
created

DataProviderManager   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 0
dl 0
loc 22
ccs 0
cts 12
cp 0
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A registerDataProvider() 0 4 1
A dataProviders() 0 4 1
A dataProvider() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is a part of Sculpin.
7
 *
8
 * (c) Dragonfly Development Inc.
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace Symplify\PHP7_Sculpin\DataProvider;
15
16
final class DataProviderManager
17
{
18
    /**
19
     * @var DataProviderInterface[]
20
     */
21
    private $dataProviders = [];
22
23
    public function registerDataProvider(string $name, DataProviderInterface $dataProvider)
24
    {
25
        $this->dataProviders[$name] = $dataProvider;
26
    }
27
28
    public function dataProviders() : array
29
    {
30
        return array_keys($this->dataProviders);
31
    }
32
33
    public function dataProvider(string $name) : DataProviderInterface
34
    {
35
        return $this->dataProviders[$name];
36
    }
37
}
38