Passed
Push — main ( af7fe2...46179f )
by Thierry
01:51 queued 14s
created

Connection::extension()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
namespace Lagdo\DbAdmin\Driver\Db;
4
5
use Lagdo\DbAdmin\Driver\DriverInterface;
6
use Lagdo\DbAdmin\Driver\UtilInterface;
7
use Lagdo\DbAdmin\Driver\TranslatorInterface;
8
9
use Lagdo\DbAdmin\Driver\Entity\TableFieldEntity;
10
11
use function is_resource;
12
use function stream_get_contents;
13
14
abstract class Connection implements ConnectionInterface
15
{
16
    /**
17
     * @var DriverInterface
18
     */
19
    protected $driver;
20
21
    /**
22
     * @var UtilInterface
23
     */
24
    protected $util;
25
26
    /**
27
     * @var TranslatorInterface
28
     */
29
    protected $trans;
30
31
    /**
32
     * The extension name
33
     *
34
     * @var string
35
     */
36
    protected $extension;
37
38
    /**
39
     * The client object used to query the database driver
40
     *
41
     * @var mixed
42
     */
43
    protected $client;
44
45
    /**
46
     * @var mixed
47
     */
48
    public $result;
49
50
    /**
51
     * The constructor
52
     *
53
     * @param DriverInterface $driver
54
     * @param UtilInterface $util
55
     * @param TranslatorInterface $trans
56
     * @param string $extension
57
     */
58
    public function __construct(DriverInterface $driver, UtilInterface $util, TranslatorInterface $trans, string $extension)
59
    {
60
        $this->driver = $driver;
61
        $this->util = $util;
62
        $this->trans = $trans;
63
        $this->extension = $extension;
64
    }
65
66
    /**
67
     * @inheritDoc
68
     */
69
    public function extension()
70
    {
71
        return $this->extension;
72
    }
73
74
    /**
75
     * @inheritDoc
76
     */
77
    public function quote(string $string)
78
    {
79
        return $string;
80
    }
81
82
    /**
83
     * @inheritDoc
84
     */
85
    public function setCharset(string $charset)
86
    {
87
    }
88
89
    /**
90
     * Get the client
91
     *
92
     * @return mixed
93
     */
94
    public function client()
95
    {
96
        return $this->client;
97
    }
98
99
    /**
100
     * @inheritDoc
101
     */
102
    public function quoteBinary(string $string)
103
    {
104
        return $this->quote($string);
105
    }
106
107
    /**
108
     * @inheritDoc
109
     */
110
    public function value($value, TableFieldEntity $field)
111
    {
112
        return (is_resource($value) ? stream_get_contents($value) : $value);
113
    }
114
115
    /**
116
     * @inheritDoc
117
     */
118
    public function defaultField()
119
    {
120
        return 0;
121
    }
122
123
    /**
124
     * @inheritDoc
125
     */
126
    public function warnings()
127
    {
128
        return '';
129
    }
130
131
    /**
132
     * @inheritDoc
133
     */
134
    public function close()
135
    {
136
        return;
137
    }
138
}
139