Passed
Pull Request — 4 (#10016)
by Ingo
10:13
created

NullConnector::supportsSavepoints()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 0
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 2
rs 10
1
<?php
2
3
namespace SilverStripe\ORM\Connect;
4
5
class NullConnector extends DBConnector implements TransactionManager
6
{
7
8
    public function exec($sql, $errorLevel = E_USER_ERROR)
0 ignored issues
show
Unused Code introduced by
The parameter $errorLevel is not used and could be removed. ( Ignorable by Annotation )

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

8
    public function exec($sql, /** @scrutinizer ignore-unused */ $errorLevel = E_USER_ERROR)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $sql is not used and could be removed. ( Ignorable by Annotation )

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

8
    public function exec(/** @scrutinizer ignore-unused */ $sql, $errorLevel = E_USER_ERROR)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
9
    {
10
        throw new \Exception('cannot query');
11
    }
12
13
    public function query($sql, $errorLevel = E_USER_ERROR)
14
    {
15
        throw new \Exception('cannot query');
16
    }
17
18
    public function preparedQuery($sql, $parameters, $errorLevel = E_USER_ERROR)
19
    {
20
        throw new \Exception('cannot query');
21
    }
22
23
    public function transactionStart($transactionMode = false, $sessionCharacteristics = false)
24
    {
25
        // no-op
26
    }
27
28
    public function transactionEnd()
29
    {
30
        // no-op
31
    }
32
33
    public function transactionRollback($savepoint = null)
34
    {
35
        // no-op
36
    }
37
38
    public function transactionSavepoint($savepoint)
39
    {
40
        // no-op
41
    }
42
43
    public function transactionDepth()
44
    {
45
        // no-op
46
    }
47
48
    public function supportsSavepoints()
49
    {
50
        // no-op
51
    }
52
53
    public function connect($parameters, $selectDB = false)
54
    {
55
        // no-op
56
    }
57
58
    public function getVersion()
59
    {
60
        // no-op
61
    }
62
63
    public function escapeString($value)
64
    {
65
        return $value;
66
    }
67
68
    public function quoteString($value)
69
    {
70
        return $value;
71
    }
72
73
    public function selectDatabase($name)
74
    {
75
        // no-op
76
    }
77
78
    public function getSelectedDatabase()
79
    {
80
        // no-op
81
    }
82
83
    public function unloadDatabase()
84
    {
85
        // no-op
86
    }
87
88
    public function getLastError()
89
    {
90
        // no-op
91
    }
92
93
    public function getGeneratedID($table)
94
    {
95
        // no-op
96
    }
97
98
    public function affectedRows()
99
    {
100
        // no-op
101
    }
102
103
    public function isActive()
104
    {
105
        return true;
106
    }
107
}
108