Completed
Push — develop ( 72ba3e...de019a )
by Marco
25s queued 12s
created

ShardingException   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Test Coverage

Coverage 66.67%

Importance

Changes 0
Metric Value
wmc 6
eloc 7
dl 0
loc 48
ccs 8
cts 12
cp 0.6667
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A activeTransaction() 0 3 1
A missingDefaultDistributionKey() 0 3 1
A notImplemented() 0 3 1
A missingDistributionType() 0 3 1
A missingDefaultFederationName() 0 3 1
A noShardDistributionValue() 0 3 1
1
<?php
2
3
namespace Doctrine\DBAL\Sharding;
4
5
use Doctrine\DBAL\DBALException;
6
7
/**
8
 * Sharding related Exceptions
9
 */
10
class ShardingException extends DBALException
11
{
12
    /**
13
     * @return \Doctrine\DBAL\Sharding\ShardingException
14
     */
15
    public static function notImplemented()
16
    {
17
        return new self('This functionality is not implemented with this sharding provider.', 1331557937);
18
    }
19
20
    /**
21
     * @return \Doctrine\DBAL\Sharding\ShardingException
22
     */
23 97
    public static function missingDefaultFederationName()
24
    {
25 97
        return new self('SQLAzure requires a federation name to be set during sharding configuration.', 1332141280);
26
    }
27
28
    /**
29
     * @return \Doctrine\DBAL\Sharding\ShardingException
30
     */
31 73
    public static function missingDefaultDistributionKey()
32
    {
33 73
        return new self('SQLAzure requires a distribution key to be set during sharding configuration.', 1332141329);
34
    }
35
36
    /**
37
     * @return \Doctrine\DBAL\Sharding\ShardingException
38
     */
39 50
    public static function activeTransaction()
40
    {
41 50
        return new self('Cannot switch shard during an active transaction.', 1332141766);
42
    }
43
44
    /**
45
     * @return \Doctrine\DBAL\Sharding\ShardingException
46
     */
47
    public static function noShardDistributionValue()
48
    {
49
        return new self('You have to specify a string or integer as shard distribution value.', 1332142103);
50
    }
51
52
    /**
53
     * @return \Doctrine\DBAL\Sharding\ShardingException
54
     */
55 73
    public static function missingDistributionType()
56
    {
57 73
        return new self("You have to specify a sharding distribution type such as 'integer', 'string', 'guid'.");
58
    }
59
}
60