Completed
Push — master ( 43b3fb...120a01 )
by Dominik
02:39
created

AbstractNode   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 9
Bugs 2 Features 0
Metric Value
wmc 3
c 9
b 2
f 0
lcom 0
cbo 0
dl 0
loc 37
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setParent() 0 8 2
A allowDefault() 0 4 1
serialize() 0 1 ?
1
<?php
2
3
namespace Saxulum\ElasticSearchQueryBuilder\Node;
4
5
abstract class AbstractNode
6
{
7
    /**
8
     * @var AbstractParentNode
9
     */
10
    protected $parent;
11
12
    /**
13
     * @param AbstractParentNode $parent
14
     */
15
    public function setParent(AbstractParentNode $parent)
16
    {
17
        if (null !== $this->parent) {
18
            throw new \InvalidArgumentException('Node already got a parent!');
19
        }
20
21
        $this->parent = $parent;
22
    }
23
24
    /**
25
     * @var boolean
26
     */
27
    protected $allowDefault;
28
29
    /**
30
     * @return boolean
31
     */
32
    public function allowDefault()
33
    {
34
        return $this->allowDefault;
35
    }
36
37
    /**
38
     * @return \stdClass|array|string|float|integer|boolean|null
39
     */
40
    abstract public function serialize();
41
}
42