Passed
Pull Request — master (#2)
by Andreas
11:41
created

GatewayException   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Test Coverage

Coverage 72.72%

Importance

Changes 1
Bugs 1 Features 0
Metric Value
wmc 3
eloc 7
c 1
b 1
f 0
dl 0
loc 20
ccs 8
cts 11
cp 0.7272
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A invalidGatewayName() 0 4 1
A gatewayAlreadyRegistered() 0 4 1
A notImplemented() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Larium\Pay;
6
7
use RuntimeException;
8
9
class GatewayException extends RuntimeException
10
{
11 1
    public static function notImplemented($transaction, $gateway): self
12
    {
13 1
        return new self(
14 1
            sprintf("Gateway `%s` does not support `%s` transaction", $gateway, $transaction)
15 1
        );
16
    }
17
18 1
    public static function invalidGatewayName($name): self
19
    {
20 1
        return new self(
21 1
            sprintf("Could not resolve gateway with name `%s`", $name)
22 1
        );
23
    }
24
25
    public static function gatewayAlreadyRegistered($name): self
26
    {
27
        return new self(
28
            sprintf("Gateway with name `%s` is already registered", $name)
29
        );
30
    }
31
}
32