Failed Conditions
Push — phpstan ( 752f9f...1acc4a )
by Michael
21:57
created

ConnectionException   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Test Coverage

Coverage 75%

Importance

Changes 0
Metric Value
wmc 4
dl 0
loc 32
ccs 6
cts 8
cp 0.75
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A savepointsNotSupported() 0 3 1
A mayNotAlterNestedTransactionWithSavepointsInTransaction() 0 3 1
A noActiveTransaction() 0 3 1
A commitFailedRollbackOnly() 0 3 1
1
<?php
2
/*
3
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
4
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
5
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
6
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
7
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
8
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
9
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
10
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
11
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
12
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
13
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14
 *
15
 * This software consists of voluntary contributions made by many individuals
16
 * and is licensed under the MIT license. For more information, see
17
 * <http://www.doctrine-project.org>.
18
 */
19
20
namespace Doctrine\DBAL;
21
22
/**
23
 * @link   www.doctrine-project.org
24
 * @since  2.0
25
 * @author Jonathan H. Wage <[email protected]
26
 */
27
class ConnectionException extends DBALException
28
{
29
    /**
30
     * @return \Doctrine\DBAL\ConnectionException
31
     */
32 34
    public static function commitFailedRollbackOnly()
33
    {
34 34
        return new self("Transaction commit failed because the transaction has been marked for rollback only.");
35
    }
36
37
    /**
38
     * @return \Doctrine\DBAL\ConnectionException
39
     */
40 68
    public static function noActiveTransaction()
41
    {
42 68
        return new self("There is no active transaction.");
43
    }
44
45
    /**
46
     * @return \Doctrine\DBAL\ConnectionException
47
     */
48
    public static function savepointsNotSupported()
49
    {
50
        return new self("Savepoints are not supported by this driver.");
51
    }
52
53
    /**
54
     * @return \Doctrine\DBAL\ConnectionException
55
     */
56 34
    public static function mayNotAlterNestedTransactionWithSavepointsInTransaction()
57
    {
58 34
        return new self("May not alter the nested transaction with savepoints behavior while a transaction is open.");
59
    }
60
}
61