GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

ZifratuFacade::decrypt()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
3
4
namespace EduSalguero\Zifratu;
5
6
7
/**
8
 * Class ZifratuFacade
9
 * @package EduSalguero\Zifratu
10
 */
11
class ZifratuFacade
12
{
13
14
    /**
15
     * @var SecretGenerator\Md5Surrounder
16
     */
17
    protected $secretKeyGenerator;
18
    /**
19
     * @var string
20
     */
21
    private $secret;
22
23
    /**
24
     * ZifratuFacade constructor.
25
     *
26
     * @param $secret
27
     */
28
    public function __construct($secret)
29
    {
30
        $this->secretKeyGenerator = new SecretGenerator\Md5Surrounder();
31
        $this->secret = $secret;
32
    }
33
34
    /**
35
     * Named constructor
36
     *
37
     * @param $secret
38
     *
39
     * @return static
40
     */
41
    public static function create($secret)
42
    {
43
        $facade = new static($secret);
44
45
        return $facade;
46
    }
47
48
    /**
49
     * Encrypt a value with a given secret using AES
50
     *
51
     * @param string $value
52
     *
53
     * @return string
54
     */
55
    public function encrypt($value)
56
    {
57
        $decripter = new Encrypter($this->secretKeyGenerator, $this->secret);
58
59
        return $decripter->encrypt($value);
60
    }
61
62
    /**
63
     * Decrypt a value with a given secret using AES
64
     *
65
     * @param string $value
66
     *
67
     * @return string
68
     */
69
    public function decrypt($value)
70
    {
71
        $decripter = new Decrypter($this->secretKeyGenerator, $this->secret);
72
73
        return $decripter->decrypt($value);
74
    }
75
}