Completed
Pull Request — master (#2)
by Tomasz
03:57 queued 02:01
created

ParentNormalizerContext   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 0
dl 0
loc 30
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A withParent() 0 9 1
A getParent() 0 4 1
A getLevel() 0 4 1
1
<?php
2
namespace Thunder\Serializard\NormalizerContext;
3
4
final class ParentNormalizerContext implements NormalizerContextInterface
5
{
6
    private $parent;
7
    /** @var int */
8
    private $level = 0;
9
10
    public function __construct()
11
    {
12
    }
13
14
    public function withParent($parent)
15
    {
16
        $context = new self();
17
18
        $context->parent = $parent;
19
        $context->level = $this->level + 1;
20
21
        return $context;
22
    }
23
24
    public function getParent()
25
    {
26
        return $this->parent;
27
    }
28
29
    public function getLevel()
30
    {
31
        return $this->level;
32
    }
33
}
34