Passed
Push — master ( e42f4d...053e33 )
by Wilmer
07:04 queued 04:48
created

AbstractQuoterProvider   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 81
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 35
c 1
b 0
f 0
dl 0
loc 81
rs 10
wmc 6
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Db\Tests\Provider;
6
7
abstract class AbstractQuoterProvider
8
{
9
    /**
10
     * @return string[][]
11
     */
12
    public function columnNames(): array
13
    {
14
        return [
15
            ['*', '*'],
16
            ['(*)', '(*)'],
17
            ['[[*]]', '[[*]]'],
18
        ];
19
    }
20
21
    /**
22
     * @return string[][]
23
     */
24
    public function ensureColumnName(): array
25
    {
26
        return [
27
            ['*', '*'],
28
            ['`*`', '`*`'],
29
            ['[[*]]', '[[*]]'],
30
            ['{{*}}', '{{*}}'],
31
            ['table.column', 'column'],
32
            ['`table`.`column`', '`column`'],
33
            ['[[table]].[[column]]', 'column'],
34
            ['{{table}}.{{column}}', '{{column}}'],
35
        ];
36
    }
37
38
    /**
39
     * @return string[][]
40
     */
41
    public function ensureNameQuoted(): array
42
    {
43
        return [
44
            ['name', '{{name}}'],
45
            ['`name`', '{{name}}'],
46
            ['[[name]]', '{{name}}'],
47
            ['{{name}}', '{{name}}'],
48
            ['table.name', '{{table.name}}'],
49
            ['`table`.`name`', '{{table.name}}'],
50
            ['[[table]].[[name]]', '{{table.name}}'],
51
            ['{{table}}.{{name}}', '{{table}}.{{name}}'],
52
        ];
53
    }
54
55
    /**
56
     * @return string[][]
57
     */
58
    public function simpleColumnNames(): array
59
    {
60
        return [
61
            ['*', '*', '*'],
62
        ];
63
    }
64
65
    /**
66
     * @return string[][]
67
     */
68
    public function simpleTableNames(): array
69
    {
70
        return [
71
            ['test', 'test'],
72
            ['(test)', '(test)'],
73
        ];
74
    }
75
76
    /**
77
     * @return string[][]
78
     */
79
    public function tableNameParts(): array
80
    {
81
        return [
82
            ['animal', 'animal',],
83
            ['dbo.animal', 'animal', 'dbo'],
84
            ['[dbo].[animal]', 'animal', 'dbo'],
85
            ['[other].[animal2]', 'animal2', 'other'],
86
            ['other.[animal2]', 'animal2', 'other'],
87
            ['other.animal2', 'animal2', 'other'],
88
        ];
89
    }
90
}
91