Completed
Push — master ( 1b9783...a1719c )
by James Ekow Abaka
01:39
created

DriverAdapterFactory::createDriverAdapter()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 5
rs 9.4285
cc 1
eloc 3
nc 1
nop 0
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: ekow
5
 * Date: 9/6/17
6
 * Time: 8:58 AM
7
 */
8
9
namespace ntentan\nibii\factories;
10
11
use ntentan\utils\Text;
12
use ntentan\nibii\interfaces\DriverAdapterFactoryInterface;
13
14
15
class DriverAdapterFactory implements DriverAdapterFactoryInterface
16
{
17
    private $driverName;
18
19
    public function __construct($config)
20
    {
21
        $this->driverName = $config['driver'];
22
    }
23
24
    public function createDriverAdapter()
25
    {
26
        $class = 'ntentan\nibii\adapters\\' . Text::ucamelize($this->driverName) . 'Adapter';
27
        return new $class();
28
    }
29
}
30