Test Failed
Push — main ( 57b19c...1fe2cd )
by Dimitri
15:57
created

EncryptionException   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 62
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
c 1
b 0
f 0
dl 0
loc 62
ccs 0
cts 6
cp 0
rs 10
wmc 6

6 Methods

Rating   Name   Duplication   Size   Complexity  
A noHandlerAvailable() 0 3 1
A noDriverRequested() 0 3 1
A authenticationFailed() 0 3 1
A needsStarterKey() 0 3 1
A unKnownHandler() 0 3 1
A encryptionFailed() 0 3 1
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