Completed
Push — master ( 8b0a23...1e5206 )
by Dominik
01:59
created

ScalarNode   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 12
Bugs 1 Features 1
Metric Value
wmc 3
c 12
b 1
f 1
lcom 0
cbo 1
dl 0
loc 33
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getAddDefault() 0 4 1
A serialize() 0 4 1
1
<?php
2
3
namespace Saxulum\ElasticSearchQueryBuilder\Node;
4
5
class ScalarNode extends AbstractNode
6
{
7
    /**
8
     * @var string|float|int|bool|null
9
     */
10
    protected $value;
11
12
    /**
13
     * @param string|float|int|bool|null $value
14
     * @param bool                       $allowAddDefault
15
     */
16
    public function __construct($value, $allowAddDefault = false)
17
    {
18
        $this->value = $value;
19
        $this->allowAddDefault = $allowAddDefault;
20
    }
21
22
    /**
23
     * @return null
24
     */
25
    public function getAddDefault()
26
    {
27
        return null;
28
    }
29
30
    /**
31
     * @return string|float|int|bool|null
32
     */
33
    public function serialize()
34
    {
35
        return $this->value;
36
    }
37
}
38