Completed
Push — master ( 46d273...229a5a )
by Mathieu
02:04
created

ConnectionWrapperTrait::wrappedDriver()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
c 1
b 1
f 0
dl 0
loc 7
rs 9.4286
cc 2
eloc 4
nc 2
nop 0
1
<?php
2
3
namespace Ez\DbLinker\Driver\Connection;
4
5
use Closure;
6
use Exception;
7
use SplObjectStorage;
8
use Doctrine\DBAL\DriverManager;
9
use Doctrine\DBAL\Driver\Connection;
10
11
trait ConnectionWrapperTrait
12
{
13
    private $wrappedConnection;
14
    private $wrappedDriver;
15
16
    /**
17
     * @inherit
18
     */
19
    public function wrappedConnection()
20
    {
21
        if ($this->wrappedConnection === null) {
22
            $this->wrap();
23
        }
24
        return $this->wrappedConnection;
25
    }
26
27
    public function wrappedDriver()
28
    {
29
        if ($this->wrappedDriver === null) {
30
            $this->wrap();
31
        }
32
        return $this->wrappedDriver;
33
    }
34
35
    abstract protected function wrap();
36
}
37