Completed
Push — master ( 0e7db1...c18576 )
by Tomasz
12s
created

ParentNormalizerContext::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 1
nc 1
nop 0
crap 1
1
<?php
2
namespace Thunder\Serializard\NormalizerContext;
3
4
final class ParentNormalizerContext implements NormalizerContextInterface
5
{
6
    private $root;
7
    private $format;
8
    private $parent;
9
    /** @var int */
10
    private $level = 0;
11
12 10
    public function __construct()
13
    {
14 10
    }
15
16 9 View Code Duplication
    public function withRoot($root)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
17
    {
18 9
        $context = new self();
19
20 9
        $context->root = $root;
21 9
        $context->format = $this->format;
22 9
        $context->parent = $this->parent;
23 9
        $context->level = $this->level;
24
25 9
        return $context;
26
    }
27
28 1
    public function getRoot()
29
    {
30 1
        return $this->root;
31
    }
32
33 9 View Code Duplication
    public function withFormat($format)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
34
    {
35 9
        $context = new self();
36
37 9
        $context->root = $this->root;
38 9
        $context->format = $format;
39 9
        $context->parent = $this->parent;
40 9
        $context->level = $this->level;
41
42 9
        return $context;
43
    }
44
45 1
    public function getFormat()
46
    {
47 1
        return $this->format;
48
    }
49
50 9 View Code Duplication
    public function withParent($parent)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
51
    {
52 9
        $context = new self();
53
54 9
        $context->root = $this->root;
55 9
        $context->format = $this->format;
56 9
        $context->parent = $parent;
57 9
        $context->level = $this->level + 1;
58
59 9
        return $context;
60
    }
61
62 1
    public function getParent()
63
    {
64 1
        return $this->parent;
65
    }
66
67 1
    public function getLevel()
68
    {
69 1
        return $this->level;
70
    }
71
}
72