AttributeNode::nextSibling()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 8
Ratio 100 %

Importance

Changes 0
Metric Value
dl 8
loc 8
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 4
nc 2
nop 0
1
<?php
2
3
namespace Saxulum\JsonDocument;
4
5
class AttributeNode extends AbstractNode
6
{
7
    /**
8
     * @var null|string|int|float|bool
9
     */
10
    protected $value;
11
12
    /**
13
     * @var ObjectNode
14
     */
15
    protected $parent;
16
17
    /**
18
     * @return string
19
     */
20
    public function getFormattedName()
21
    {
22
        return '@' . $this->name;
23
    }
24
25
    /**
26
     * @return bool|float|int|null|string
27
     */
28
    public function getValue()
29
    {
30
        return $this->value;
31
    }
32
33
    /**
34
     * @param  bool|float|int|null|string $value
35
     * @return $this
36
     */
37
    public function setValue($value)
38
    {
39
        $this->value = $value;
40
    }
41
42
    /**
43
     * @return null|AttributeNode
44
     */
45 View Code Duplication
    public function previousSibling()
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...
46
    {
47
        if (null === $parent = $this->parent) {
48
            return null;
49
        }
50
51
        return $this->getSibling($parent->getAttributes(), -1);
52
    }
53
54
    /**
55
     * @return null|AttributeNode
56
     */
57 View Code Duplication
    public function nextSibling()
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...
58
    {
59
        if (null === $parent = $this->parent) {
60
            return null;
61
        }
62
63
        return $this->getSibling($parent->getAttributes(), 1);
64
    }
65
}
66