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

ConnectionWrapperTrait   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 1
Bugs 1 Features 0
Metric Value
wmc 4
c 1
b 1
f 0
lcom 1
cbo 0
dl 0
loc 26
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A wrappedConnection() 0 7 2
A wrappedDriver() 0 7 2
wrap() 0 1 ?
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