JsonObjectEncrypter   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 17
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A encrypt() 0 3 1
A decrypt() 0 3 1
1
<?php
2
3
namespace Endeavors\Components\Encryption;
4
5
use Endeavors\Components\Encryption\Contracts\IEncrypter;
6
use Endeavors\Components\Encryption\Contracts\IOriginalEncrypter;
7
use Endeavors\Components\Encryption\Contracts\IJsonDecrypter;
8
9
class JsonObjectEncrypter implements IEncrypter
10
{
11
    private $encrypter;
12
13
    public function __construct(IJsonDecrypter $encrypter)
14
    {
15
        $this->encrypter = $encrypter->decryptAsObject();
16
    }
17
18
    public function encrypt($value)
19
    {
20
        return $this->encrypter->encrypt($value);
21
    }
22
23
    public function decrypt(string $value)
24
    {
25
        return $this->encrypter->decrypt($value);
26
    }
27
}