Completed
Push — master ( f64d24...b2dcac )
by Jasper
04:10
created

EncryptedCast::set()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 1
c 1
b 0
f 0
nc 2
nop 4
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 2
rs 10
1
<?php
2
3
namespace Swis\Laravel\Encrypted;
4
5
use Illuminate\Contracts\Database\Eloquent\CastsAttributes;
6
7
class EncryptedCast implements CastsAttributes
8
{
9 6
    public function get($model, string $key, $value, array $attributes)
10
    {
11 6
        return $value === null ? null : decrypt($value);
12
    }
13
14 6
    public function set($model, string $key, $value, array $attributes)
15
    {
16 6
        return $value === null ? null : encrypt($value);
17
    }
18
}
19