Test Setup Failed
Pull Request — master (#5)
by Chris
03:21
created

LegacySerializer   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 2
dl 0
loc 19
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
    public function unserialize($data)
19
    {
20
        return new ValueHolder($data);
21
    }
22
23
    public function getIdentifier(): IdentityInterface
24
    {
25
        return new SerializerIdentity(self::IDENTITY);
26
    }
27
}
28