Test Failed
Pull Request — master (#94)
by Wilmer
14:06 queued 02:52
created

Quoter::quoteValue()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 3
c 1
b 0
f 0
nc 2
nop 1
dl 0
loc 7
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Db\Mysql;
6
7
use Yiisoft\Db\Schema\Quoter as BaseQuoter;
0 ignored issues
show
Bug introduced by
The type Yiisoft\Db\Schema\Quoter 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...
8
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...
9
10
final class Quoter extends BaseQuoter implements QuoterInterface
11
{
12
    public function __construct(
13
        private array|string $columnQuoteCharacter,
14
        private array|string $tableQuoteCharacter,
15
        private string $tablePrefix = ''
16
    ) {
17
        parent::__construct($columnQuoteCharacter, $tableQuoteCharacter, $tablePrefix);
18
    }
19
20
    public function quoteValue(int|string $value): int|string
21
    {
22
        if (!is_string($value)) {
23
            return $value;
24
        }
25
26
        return "'" . preg_replace('~[\x00\x0A\x0D\x1A\x22\x25\x27\x5C\x5F]~u', '\\\$0', $value) . "'";
27
    }
28
}
29