Failed Conditions
Pull Request — develop (#3348)
by Sergei
10:40
created

ShardingException   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Test Coverage

Coverage 80%

Importance

Changes 0
Metric Value
wmc 5
eloc 6
dl 0
loc 25
ccs 8
cts 10
cp 0.8
rs 10
c 0
b 0
f 0

5 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
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Doctrine\DBAL\Sharding;
6
7
use Doctrine\DBAL\DBALException;
8
9
/**
10
 * Sharding related Exceptions
11
 */
12
class ShardingException extends DBALException
13
{
14
    public static function notImplemented() : self
15
    {
16
        return new self('This functionality is not implemented with this sharding provider.', 1331557937);
17
    }
18
19 105
    public static function missingDefaultFederationName() : self
20
    {
21 105
        return new self('SQLAzure requires a federation name to be set during sharding configuration.', 1332141280);
22
    }
23
24 79
    public static function missingDefaultDistributionKey() : self
25
    {
26 79
        return new self('SQLAzure requires a distribution key to be set during sharding configuration.', 1332141329);
27
    }
28
29 54
    public static function activeTransaction() : self
30
    {
31 54
        return new self('Cannot switch shard during an active transaction.', 1332141766);
32
    }
33
34 79
    public static function missingDistributionType() : self
35
    {
36 79
        return new self("You have to specify a sharding distribution type such as 'integer', 'string', 'guid'.");
37
    }
38
}
39