NormalizableTrait::normalize()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 6
ccs 4
cts 4
cp 1
rs 9.4285
cc 1
eloc 3
nc 1
nop 1
crap 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