Completed
Push — master ( e02933...197ad6 )
by ARCANEDEV
08:16
created

Manager   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 24
ccs 0
cts 9
cp 0
rs 10
wmc 3
lcom 1
cbo 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A createDriver() 0 14 3
1
<?php namespace Arcanedev\Support;
2
3
use Illuminate\Support\Manager as IlluminateManager;
4
use Illuminate\Support\Str;
5
use InvalidArgumentException;
6
7
/**
8
 * Class     Manager
9
 *
10
 * @package  Arcanedev\Support
11
 * @author   ARCANEDEV <[email protected]>
12
 */
13
abstract class Manager extends IlluminateManager
14
{
15
    /**
16
     * Create a new driver instance.
17
     *
18
     * @param  string  $driver
19
     *
20
     * @return mixed
21
     */
22
    protected function createDriver($driver)
23
    {
24
        $method = 'create'.Str::studly($driver).'Driver';
25
26
        // We'll check to see if a creator method exists for the given driver. If not we
27
        // will check for a custom driver creator, which allows developers to create
28
        // drivers using their own customized driver creator Closure to create it.
29
        if (isset($this->customCreators[$driver]))
30
            return $this->callCustomCreator($driver);
31
        elseif (method_exists($this, $method))
32
            return $this->$method();
33
34
        throw new InvalidArgumentException("Driver [$driver] not supported.");
35
    }
36
}
37