Completed
Push — master ( 9be2e3...3a8fde )
by Gaël
14:21
created

Exception::invalidResourceParameter()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace DansMaCulotte\Monetico\Exceptions;
4
5
class Exception extends \Exception
6
{
7
    /**
8
     * @param string $eptCode
9
     * @return Exception
10
     */
11
    public static function invalidEptCode(string $eptCode): self
12
    {
13
        return new self("EPT code is invalid, should be 7 characters long: ${eptCode}");
14
    }
15
16
    /**
17
     * @return Exception
18
     */
19
    public static function invalidSecurityKey(): self
20
    {
21
        return new self("Security key is invalid, should be 40 characters long.");
22
    }
23
24
25
    /**
26
     * @return Exception
27
     */
28
    public static function invalidDatetime(): self
29
    {
30
        return new self("dateTime value is not a DateTime object");
31
    }
32
33
    /**
34
     * @return Exception
35
     */
36
    public static function invalidRecoveryDate(): self
37
    {
38
        return new self("recoveryDate value is not a DateTime object");
39
    }
40
41
    /**
42
     * @param string $invoiceType
43
     * @return Exception
44
     */
45
    public static function invalidResponseInvoiceType(string $invoiceType): self
46
    {
47
        return new self("type_facture value is invalid: ${invoiceType}");
48
    }
49
50
    /**
51
     * @param string $invoiceType
52
     * @return Exception
53
     */
54
    public static function invalidInvoiceType(string $invoiceType): self
55
    {
56
        return new self("invoiceType value is invalid: ${invoiceType}");
57
    }
58
59
    /**
60
     * @param string $language
61
     * @return Exception
62
     */
63
    public static function invalidLanguage(string $language): self
64
    {
65
        return new self("language value is invalid, should be 12 characters long maximum: ${language}");
66
    }
67
68
    /**
69
     * @param string $reference
70
     * @return Exception
71
     */
72
    public static function invalidReference(string $reference): self
73
    {
74
        return new self("reference value is invalid, should be 12 characters long maximum: ${reference}");
75
    }
76
77
    /**
78
     * @param string $key
79
     * @return Exception
80
     */
81
    public static function missingResponseKey(string $key): self
82
    {
83
        return new self("${key} is missing");
84
    }
85
86
    /**
87
     *
88
     * @return Exception
89
     */
90
    public static function invalidResponseDateTime(): self
91
    {
92
        return new self("date value is invalid");
93
    }
94
95
    /**
96
     * @param string $fileNumber
97
     * @return Exception
98
     */
99
    public static function invalidResponseFileNumber($fileNumber): self
100
    {
101
        return new self("numero_dossier value is invalid: ${fileNumber}");
102
    }
103
104
    /**
105
     * @return Exception
106
     */
107
    public static function invalidOrderDate(): self
108
    {
109
        return new self("orderDate value is not a DateTime object");
110
    }
111
112
    /**
113
     * @param string $name
114
     * @return Exception
115
     */
116
    public static function invalidResourceParameter(string $name): self
117
    {
118
        return new self("resource parameter is invalid: {$name}");
119
    }
120
}
121