Passed
Pull Request — master (#13)
by
unknown
03:10
created

InvalidSecretWordException::missingLetters()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
eloc 1
c 1
b 1
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Skrill\Exception;
6
7
use Exception;
8
use Skrill\ValueObject\SecretWord;
9
10
/**
11
 * Class InvalidSecretWordException.
12
 */
13
final class InvalidSecretWordException extends Exception implements SkrillException
14
{
15
    /**
16
     * @return InvalidSecretWordException
17
     */
18
    public static function emptySecretWord(): self
19
    {
20
        return new self('Skrill secret word should not be blank.');
21
    }
22
23
    /**
24
     * @return InvalidSecretWordException
25
     */
26
    public static function invalidMinLength(): self
27
    {
28
        return new self(sprintf(
29
            'The length of Skrill Secret Word is too short. It should have %d characters or more.',
30
            SecretWord::MIN_LENGTH
31
        ));
32
    }
33
34
    /**
35
     * @return InvalidSecretWordException
36
     */
37
    public static function missingLetters(): self
38
    {
39
        return new self('Skrill Secret Word must include at least one letter.');
40
    }
41
42
    /**
43
     * @return InvalidSecretWordException
44
     */
45
    public static function missingNonAlphabetic(): self
46
    {
47
        return new self('Skrill Secret Word must include at least one non-alphabetic character.');
48
    }
49
}
50