JsonObjectEncrypter::encrypt()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

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