Completed
Pull Request — master (#19)
by Michal
08:13
created

DriverStorage::getDriver()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 2
eloc 2
nc 2
nop 1
crap 2
1
<?php
2
3
namespace Adminerng\Core\Driver;
4
5
class DriverStorage
6
{
7
    private $drivers = [];
8
9 2
    public function add(DriverInterface $driver)
10
    {
11 2
        $this->drivers[$driver->type()] = $driver;
12 2
        return $this;
13
    }
14
15
    /**
16
     * @return DriverInterface[]
17
     */
18 2
    public function getDrivers()
19
    {
20 2
        return $this->drivers;
21
    }
22
23 2
    public function getDriver($driver)
24
    {
25 2
        return isset($this->drivers[$driver]) ? $this->drivers[$driver] : null;
26
    }
27
}
28