Failed Conditions
Pull Request — develop (#3348)
by Sergei
65:23
created

ShardingException::noShardDistributionValue()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
ccs 0
cts 1
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 2
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
    public static function missingDefaultFederationName() : self
20
    {
21
        return new self('SQLAzure requires a federation name to be set during sharding configuration.', 1332141280);
22
    }
23 97
24
    public static function missingDefaultDistributionKey() : self
25 97
    {
26
        return new self('SQLAzure requires a distribution key to be set during sharding configuration.', 1332141329);
27
    }
28
29
    public static function activeTransaction() : self
30
    {
31 73
        return new self('Cannot switch shard during an active transaction.', 1332141766);
32
    }
33 73
34
    public static function missingDistributionType() : self
35
    {
36
        return new self("You have to specify a sharding distribution type such as 'integer', 'string', 'guid'.");
37
    }
38
}
39