Test Failed
Pull Request — main (#17)
by Dimitri
16:16 queued 22s
created

EncryptionException::needsStarterKey()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
ccs 0
cts 1
cp 0
crap 2
rs 10
1
<?php
2
3
/**
4
 * This file is part of Blitz PHP framework.
5
 *
6
 * (c) 2022 Dimitri Sitchet Tomkeu <[email protected]>
7
 *
8
 * For the full copyright and license information, please view
9
 * the LICENSE file that was distributed with this source code.
10
 */
11
12
namespace BlitzPHP\Exceptions;
13
14
use RuntimeException;
15
16
/**
17
 * Encryption exception
18
 */
19
class EncryptionException extends RuntimeException implements ExceptionInterface
20
{
21
    use DebugTraceableTrait;
22
23
    /**
24
     * Lancée lorsqu'aucun pilote n'est présent dans la session de chiffrement active.
25
     *
26
     * @return static
27
     */
28
    public static function noDriverRequested()
29
    {
30
        return new static(lang('Encryption.noDriverRequested'));
31
    }
32
33
    /**
34
     * Lancé lorsque le gestionnaire demandé n'est pas disponible.
35
     *
36
     * @return static
37
     */
38
    public static function noHandlerAvailable(string $handler)
39
    {
40
        return new static(lang('Encryption.noHandlerAvailable', [$handler]));
41
    }
42
43
    /**
44
     * Lancé lorsque le gestionnaire demandé est inconnu.
45
     *
46
     * @return static
47
     */
48
    public static function unKnownHandler(?string $driver = null)
49
    {
50
        return new static(lang('Encryption.unKnownHandler', [$driver]));
51
    }
52
53
    /**
54
     * Lancée lorsqu'aucune clé de démarrage n'est fournie pour la session de chiffrement en cours.
55
     *
56
     * @return static
57
     */
58
    public static function needsStarterKey()
59
    {
60
        return new static(lang('Encryption.starterKeyNeeded'));
61
    }
62
63
    /**
64
     * Lancée lors du décryptage des données lorsqu'un problème ou une erreur s'est produite.
65
     *
66
     * @return static
67
     */
68
    public static function authenticationFailed()
69
    {
70
        return new static(lang('Encryption.authenticationFailed'));
71
    }
72
73
    /**
74
     * Lancée lors du cryptage des données lorsqu'un problème ou une erreur s'est produite.
75
     *
76
     * @return static
77
     */
78
    public static function encryptionFailed()
79
    {
80
        return new static(lang('Encryption.encryptionFailed'));
81
    }
82
}
83