InvalidSecretWordException   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 5
c 1
b 0
f 0
dl 0
loc 26
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A emptySecretWord() 0 3 1
A invalidMaxLength() 0 4 1
A specialCharacters() 0 3 1
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 invalidMaxLength(): self
27
    {
28
        return new self(
29
            sprintf('The length of Skrill secret word should not exceed %d characters.', SecretWord::MAX_LENGTH)
30
        );
31
    }
32
33
    /**
34
     * @return InvalidSecretWordException
35
     */
36
    public static function specialCharacters(): self
37
    {
38
        return new self('Special characters are not permitted in Skrill secret word.');
39
    }
40
}
41