Passed
Push — dev ( 7ae04d...cd5ace )
by Def
30:02 queued 08:14
created

QueryBuilderPDOOracle::batchInsert()   C

Complexity

Conditions 13
Paths 85

Size

Total Lines 60
Code Lines 32

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 31
CRAP Score 13.0051

Importance

Changes 0
Metric Value
cc 13
eloc 32
nc 85
nop 4
dl 0
loc 60
ccs 31
cts 32
cp 0.9688
crap 13.0051
rs 6.6166
c 0
b 0
f 0

How to fix   Long Method    Complexity   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Db\Oracle\PDO;
6
7
use Yiisoft\Db\Oracle\DDLQueryBuilder;
8
use Yiisoft\Db\Oracle\DMLQueryBuilder;
9
use Yiisoft\Db\Oracle\DQLQueryBuilder;
10
use Yiisoft\Db\Query\QueryBuilder;
11
use Yiisoft\Db\Schema\QuoterInterface;
12
use Yiisoft\Db\Schema\Schema;
13
use Yiisoft\Db\Schema\SchemaInterface;
14
15
/**
16
 * QueryBuilder is the query builder for Oracle databases.
17
 */
18
final class QueryBuilderPDOOracle extends QueryBuilder
19
{
20
    /**
21
     * @psalm-var string[] $typeMap Mapping from abstract column types (keys) to physical column types (values).
22
     */
23
    protected array $typeMap = [
24
        Schema::TYPE_PK => 'NUMBER(10) NOT NULL PRIMARY KEY',
25
        Schema::TYPE_UPK => 'NUMBER(10) UNSIGNED NOT NULL PRIMARY KEY',
26
        Schema::TYPE_BIGPK => 'NUMBER(20) NOT NULL PRIMARY KEY',
27
        Schema::TYPE_UBIGPK => 'NUMBER(20) UNSIGNED NOT NULL PRIMARY KEY',
28
        Schema::TYPE_CHAR => 'CHAR(1)',
29
        Schema::TYPE_STRING => 'VARCHAR2(255)',
30
        Schema::TYPE_TEXT => 'CLOB',
31
        Schema::TYPE_TINYINT => 'NUMBER(3)',
32
        Schema::TYPE_SMALLINT => 'NUMBER(5)',
33
        Schema::TYPE_INTEGER => 'NUMBER(10)',
34
        Schema::TYPE_BIGINT => 'NUMBER(20)',
35
        Schema::TYPE_FLOAT => 'NUMBER',
36
        Schema::TYPE_DOUBLE => 'NUMBER',
37
        Schema::TYPE_DECIMAL => 'NUMBER',
38
        Schema::TYPE_DATETIME => 'TIMESTAMP',
39
        Schema::TYPE_TIMESTAMP => 'TIMESTAMP',
40
        Schema::TYPE_TIME => 'TIMESTAMP',
41
        Schema::TYPE_DATE => 'DATE',
42
        Schema::TYPE_BINARY => 'BLOB',
43
        Schema::TYPE_BOOLEAN => 'NUMBER(1)',
44
        Schema::TYPE_MONEY => 'NUMBER(19,4)',
45
    ];
46
    private DDLQueryBuilder $ddlBuilder;
47
    private DMLQueryBuilder $dmlBuilder;
48
    private DQLQueryBuilder $dqlBuilder;
49
50 344
    public function __construct(
51
        protected QuoterInterface $quoter,
52
        protected SchemaInterface $schema
53
    ) {
54 344
        $this->ddlBuilder = new DDLQueryBuilder($this);
55 344
        $this->dmlBuilder = new DMLQueryBuilder($this);
56 344
        $this->dqlBuilder = new DQLQueryBuilder($this);
57 344
        parent::__construct($quoter, $schema, $this->ddlBuilder, $this->dmlBuilder, $this->dqlBuilder);
58
    }
59
}
60