Passed
Pull Request — master (#160)
by Dmitriy
02:24
created

ConnectionInterfaceProxy::quoteValue()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Yii\Debug\Collector\Database;
6
7
use Closure;
8
use Yiisoft\Cache\Dependency\Dependency;
9
use Yiisoft\Db\Command\CommandInterface;
0 ignored issues
show
Bug introduced by
The type Yiisoft\Db\Command\CommandInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
10
use Yiisoft\Db\Connection\ConnectionInterface;
0 ignored issues
show
Bug introduced by
The type Yiisoft\Db\Connection\ConnectionInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
11
use Yiisoft\Db\Query\BatchQueryResultInterface;
0 ignored issues
show
Bug introduced by
The type Yiisoft\Db\Query\BatchQueryResultInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
12
use Yiisoft\Db\Query\QueryInterface;
0 ignored issues
show
Bug introduced by
The type Yiisoft\Db\Query\QueryInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
13
use Yiisoft\Db\QueryBuilder\QueryBuilderInterface;
0 ignored issues
show
Bug introduced by
The type Yiisoft\Db\QueryBuilder\QueryBuilderInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
14
use Yiisoft\Db\Schema\QuoterInterface;
0 ignored issues
show
Bug introduced by
The type Yiisoft\Db\Schema\QuoterInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
15
use Yiisoft\Db\Schema\SchemaInterface;
0 ignored issues
show
Bug introduced by
The type Yiisoft\Db\Schema\SchemaInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
16
use Yiisoft\Db\Schema\TableSchemaInterface;
0 ignored issues
show
Bug introduced by
The type Yiisoft\Db\Schema\TableSchemaInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
17
use Yiisoft\Db\Transaction\TransactionInterface;
0 ignored issues
show
Bug introduced by
The type Yiisoft\Db\Transaction\TransactionInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
18
19
final class ConnectionInterfaceProxy implements ConnectionInterface
20
{
21
    public function __construct(
22
        private ConnectionInterface $connection,
23
        private DatabaseCollector $collector
24
    ) {
25
    }
26
27
    public function beginTransaction(string $isolationLevel = null): TransactionInterface
28
    {
29
        return $this->connection->beginTransaction($isolationLevel);
30
    }
31
32
    public function cache(Closure $closure, int $duration = null, Dependency $dependency = null): mixed
33
    {
34
        return $this->connection->cache($closure, $duration, $dependency);
35
    }
36
37
    public function createBatchQueryResult(QueryInterface $query, bool $each = false): BatchQueryResultInterface
38
    {
39
        return $this->connection->createBatchQueryResult($query, $each);
40
    }
41
42
    public function createCommand(string $sql = null, array $params = []): CommandInterface
43
    {
44
        [$callStack] = debug_backtrace();
45
46
        $this->collector->collect($sql, $params, $callStack['file'] . ':' . $callStack['line']);
0 ignored issues
show
Bug introduced by
It seems like $sql can also be of type null; however, parameter $sql of Yiisoft\Yii\Debug\Collec...aseCollector::collect() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

46
        $this->collector->collect(/** @scrutinizer ignore-type */ $sql, $params, $callStack['file'] . ':' . $callStack['line']);
Loading history...
47
48
        return $this->connection->createCommand($sql, $params);
49
    }
50
51
    public function createTransaction(): TransactionInterface
52
    {
53
        return $this->connection->createTransaction();
54
    }
55
56
    public function close(): void
57
    {
58
        $this->connection->close();
59
    }
60
61
    public function getCacheKey(): array
62
    {
63
        return $this->connection->getCacheKey();
64
    }
65
66
    public function getName(): string
67
    {
68
        return $this->connection->getName();
69
    }
70
71
    public function getLastInsertID(string $sequenceName = null): string
72
    {
73
        return $this->connection->getLastInsertID($sequenceName);
74
    }
75
76
    public function getQueryBuilder(): QueryBuilderInterface
77
    {
78
        return $this->connection->getQueryBuilder();
79
    }
80
81
    public function getQuoter(): QuoterInterface
82
    {
83
        return $this->connection->getQuoter();
84
    }
85
86
    public function getSchema(): SchemaInterface
87
    {
88
        return $this->connection->getSchema();
89
    }
90
91
    public function getServerVersion(): string
92
    {
93
        return $this->connection->getServerVersion();
94
    }
95
96
    public function getTablePrefix(): string
97
    {
98
        return $this->connection->getTablePrefix();
99
    }
100
101
    public function getTableSchema(string $name, bool $refresh = false): TableSchemaInterface|null
102
    {
103
        return $this->connection->getTableSchema($name, $refresh);
104
    }
105
106
    public function getTransaction(): TransactionInterface|null
107
    {
108
        return $this->connection->getTransaction();
109
    }
110
111
    public function isActive(): bool
112
    {
113
        return $this->connection->isActive();
114
    }
115
116
    public function isSavepointEnabled(): bool
117
    {
118
        return $this->connection->isSavepointEnabled();
119
    }
120
121
    public function noCache(Closure $closure): mixed
122
    {
123
        return $this->connection->noCache($closure);
124
    }
125
126
    public function notProfiler(): void
127
    {
128
        $this->connection->notProfiler();
129
    }
130
131
    public function open(): void
132
    {
133
        $this->connection->open();
134
    }
135
136
    public function queryCacheEnable(bool $value): void
137
    {
138
        $this->connection->queryCacheEnable($value);
139
    }
140
141
    public function quoteValue(mixed $value): mixed
142
    {
143
        return $this->connection->quoteValue($value);
144
    }
145
146
    public function setEnableSavepoint(bool $value): void
147
    {
148
        $this->connection->setEnableSavepoint($value);
149
    }
150
151
    public function setTablePrefix(string $value): void
152
    {
153
        $this->connection->setTablePrefix($value);
154
    }
155
156
    public function transaction(Closure $closure, string $isolationLevel = null): mixed
157
    {
158
        return $this->connection->transaction($closure, $isolationLevel);
159
    }
160
}
161