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

ParentNormalizerContext::getLevel()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
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