Passed
Pull Request — master (#5)
by Chris
02:42
created

LegacySerializer   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 66.67%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 2
dl 0
loc 19
ccs 4
cts 6
cp 0.6667
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A serialize() 0 4 1
A unserialize() 0 4 1
A getIdentifier() 0 4 1
1
<?php
2
3
namespace Carnage\EncryptedColumn\Serializer;
4
5
use Carnage\EncryptedColumn\ValueObject\IdentityInterface;
6
use Carnage\EncryptedColumn\ValueObject\SerializerIdentity;
7
use Carnage\EncryptedColumn\ValueObject\ValueHolder;
8
9
class LegacySerializer implements SerializerInterface
10
{
11
    const IDENTITY = 'legacy';
12
13
    public function serialize($data)
14
    {
15
        throw new \Exception('This class is for read only access to legacy data');
16
    }
17
18 1
    public function unserialize($data)
19
    {
20 1
        return new ValueHolder($data);
21
    }
22
23 1
    public function getIdentifier(): IdentityInterface
24
    {
25 1
        return new SerializerIdentity(self::IDENTITY);
26
    }
27
}
28