Failed Conditions
Pull Request — master (#3319)
by Massimiliano
11:33
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
eloc 5
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 mayNotAlterNestedTransactionWithSavepointsInTransaction() 0 3 1
A noActiveTransaction() 0 3 1
A commitFailedRollbackOnly() 0 3 1
A savepointsNotSupported() 0 3 1
1
<?php
2
3
namespace Doctrine\DBAL;
4
5
class ConnectionException extends DBALException
6
{
7
    /**
8
     * @return \Doctrine\DBAL\ConnectionException
9
     */
10 42
    public static function commitFailedRollbackOnly()
11
    {
12 42
        return new self('Transaction commit failed because the transaction has been marked for rollback only.');
13
    }
14
15
    /**
16
     * @return \Doctrine\DBAL\ConnectionException
17
     */
18 84
    public static function noActiveTransaction()
19
    {
20 84
        return new self('There is no active transaction.');
21
    }
22
23
    /**
24
     * @return \Doctrine\DBAL\ConnectionException
25
     */
26
    public static function savepointsNotSupported()
27
    {
28
        return new self('Savepoints are not supported by this driver.');
29
    }
30
31
    /**
32
     * @return \Doctrine\DBAL\ConnectionException
33
     */
34 42
    public static function mayNotAlterNestedTransactionWithSavepointsInTransaction()
35
    {
36 42
        return new self('May not alter the nested transaction with savepoints behavior while a transaction is open.');
37
    }
38
}
39