Passed
Pull Request — master (#13)
by Sebastian
03:25
created

DecryptSettings::setDefaultKey()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
rs 10
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