NormalizableTrait   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
c 0
b 0
f 0
lcom 0
cbo 1
dl 0
loc 22
ccs 8
cts 8
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A normalize() 0 6 1
A denormalize() 0 6 1
1
<?php
2
3
namespace Majora\Framework\Normalizer\Model;
4
5
use Majora\Framework\Normalizer\MajoraNormalizer;
6
7
/**
8
 * Implements a generic normalization, based on base object properties.
9
 */
10
trait NormalizableTrait
11
{
12
    /**
13
     * @see NormalizableInterface::normalize()
14
     */
15 16
    public function normalize($scope = 'default')
16
    {
17 16
        return MajoraNormalizer::createNormalizer()
18 16
            ->scopify($this, $scope)
19 7
        ;
20
    }
21
22
    /**
23
     * @see SerializableInterface::denormalize()
24
     */
25 16
    public function denormalize(array $data)
26
    {
27 16
        return MajoraNormalizer::createNormalizer()
28 16
            ->denormalize($data, $this)
29 7
        ;
30
    }
31
}
32