Passed
Push — master ( 42feb8...1cd426 )
by Dominik
02:11
created

FloatNode::create()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 8
Ratio 100 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
dl 8
loc 8
ccs 5
cts 5
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 5
nc 1
nop 2
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Saxulum\ElasticSearchQueryBuilder\Node;
6
7 View Code Duplication
final class FloatNode extends AbstractNode
0 ignored issues
show
Duplication introduced by
This class 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...
8
{
9
    /**
10
     * @var float|null
11
     */
12
    private $value;
13
14
    /**
15
     * @param float|null $value
16
     * @param bool $allowSerializeEmpty
17
     * @return FloatNode
18
     */
19 4
    public static function create(float $value = null, bool $allowSerializeEmpty = false): FloatNode
20
    {
21 4
        $node = new self;
22 4
        $node->value = $value;
23 4
        $node->allowSerializeEmpty = $allowSerializeEmpty;
24
25 4
        return $node;
26
    }
27
28
    /**
29
     * @return null
30
     */
31 1
    public function serializeEmpty()
32
    {
33 1
        return;
34
    }
35
36
    /**
37
     * @return float|null
38
     */
39 2
    public function serialize()
40
    {
41 2
        return $this->value;
42
    }
43
}
44