Test Failed
Pull Request — master (#13)
by Sebastian
04:03
created

DecryptSettings   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 22
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getDefaultKey() 0 3 1
A setDefaultKey() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Mailcode\Decrypt;
6
7
use Mailcode\Interfaces\Commands\Validation\DecryptInterface;
8
9
class DecryptSettings
10
{
11
    private static ?string $defaultKey = null;
12
13
    /**
14
     * @param string|NULL $decryptionKey A decryption key
15
     * @return void
16
     */
17
    public static function setDefaultKey(?string $decryptionKey): void
18
    {
19
        self::$defaultKey = $decryptionKey;
20
    }
21
22
    /**
23
     * Gets the default decryption key for decryption. If not set via
24
     * {@see self::setDefaultDecryptionKey()}, this defaults to {@see DecryptInterface::DEFAULT_DECRYPTION_KEY}.
25
     *
26
     * @return string
27
     */
28
    public static function getDefaultKey(): string
29
    {
30
        return self::$defaultKey ?? DecryptInterface::DEFAULT_DECRYPTION_KEY;
31
    }
32
}
33