InvalidArgumentException   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 15
ccs 6
cts 6
cp 1
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A invalidReplicaAmount() 0 3 1
A __construct() 0 3 1
A invalidWeight() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
/**
6
 * This file is part of Esi\ConsistentHash.
7
 *
8
 * (c) Eric Sizemore <[email protected]>
9
 * (c) Paul Annesley <[email protected]>
10
 *
11
 * This source file is subject to the MIT license. For the full copyright and
12
 * license information, please view the LICENSE file that was distributed with
13
 * this source code.
14
 */
15
16
namespace Esi\ConsistentHash\Exception;
17
18
use InvalidArgumentException as BaseInvalidArgumentException;
19
20
final class InvalidArgumentException extends BaseInvalidArgumentException
21
{
22 2
    protected function __construct(string $message)
23
    {
24 2
        parent::__construct($message);
25
    }
26
27 1
    public static function invalidReplicaAmount(int $replicas): self
28
    {
29 1
        return new self(\sprintf("\$replicas expects a value greater than 0, '%d' provided.", $replicas));
30
    }
31
32 1
    public static function invalidWeight(float $weight): self
33
    {
34 1
        return new self(\sprintf("\$weight expects a value greater than 0.0, '%.2f' provided.", $weight));
35
    }
36
}
37