Capsule5Adapter::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1
1
<?php
2
3
namespace Soluble\DbWrapper\Adapter\Laravel;
4
5
use Soluble\DbWrapper\Adapter\AdapterInterface;
6
use Soluble\DbWrapper\Connection\Laravel\Capsule5Connection;
7
use Soluble\DbWrapper\Adapter\Pdo\GenericPdo;
8
9
class Capsule5Adapter extends GenericPdo implements AdapterInterface
10
{
11
    /**
12
     * @var \Illuminate\Database\Capsule\Manager
13
     */
14
    protected $capsule;
15
16
    /**
17
     * @var Capsule5Connection
18
     */
19
    protected $connection;
20
21
    /**
22
     * @var \PDO
23
     */
24
    protected $resource;
25
26
    /**
27
     * Constructor.
28
     *
29
     * @param \Illuminate\Database\Capsule\Manager $capsule
30
     */
31 6
    public function __construct(\Illuminate\Database\Capsule\Manager $capsule)
32
    {
33 6
        $this->capsule = $capsule;
34 6
        $this->connection = new Capsule5Connection($this, $capsule);
35 6
        $this->resource = $capsule->getConnection()->getPdo();
36 6
    }
37
38
    /**
39
     * {@inheritdoc}
40
     *
41
     * @return Capsule5Connection
42
     */
43 1
    public function getConnection()
44
    {
45 1
        return $this->connection;
46
    }
47
}
48