IlluminateDriver::getAdapter()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 1 Features 0
Metric Value
c 2
b 1
f 0
dl 0
loc 6
rs 9.4285
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
3
namespace Analogue\ORM\Drivers;
4
5
class IlluminateDriver implements DriverInterface
6
{
7
    /**
8
     * The Illuminate Connection Provider
9
     *
10
     * @var CapsuleConnectionProvider|IlluminateConnectionProvider
11
     */
12
    protected $connectionProvider;
13
14
    /**
15
     * IlluminateDriver constructor.
16
     * @param $connectionProvider
17
     */
18
    public function __construct($connectionProvider)
19
    {
20
        $this->connectionProvider = $connectionProvider;
21
    }
22
23
    /**
24
     * Return the name of the driver
25
     *
26
     * @return string
27
     */
28
    public function getName()
29
    {
30
        return 'illuminate';
31
    }
32
33
    /**
34
     * Get Analogue DBAdapter
35
     *
36
     * @param  string|null $connection
37
     * @return IlluminateDBAdapter
38
     */
39
    public function getAdapter($connection = null)
40
    {
41
        $connection = $this->connectionProvider->connection($connection);
42
43
        return new IlluminateDBAdapter($connection);
44
    }
45
}
46