Code Duplication    Length = 37-37 lines in 4 locations

src/Node/BoolNode.php 1 location

@@ 7-43 (lines=37) @@
4
5
namespace Saxulum\ElasticSearchQueryBuilder\Node;
6
7
final class BoolNode extends AbstractNode
8
{
9
    /**
10
     * @var bool|null
11
     */
12
    private $value;
13
14
    /**
15
     * @param bool|null $value
16
     * @param bool $allowSerializeEmpty
17
     * @return BoolNode
18
     */
19
    public static function create(bool $value = null, bool $allowSerializeEmpty = false): BoolNode
20
    {
21
        $node = new self;
22
        $node->value = $value;
23
        $node->allowSerializeEmpty = $allowSerializeEmpty;
24
25
        return $node;
26
    }
27
28
    /**
29
     * @return null
30
     */
31
    public function serializeEmpty()
32
    {
33
        return;
34
    }
35
36
    /**
37
     * @return bool|null
38
     */
39
    public function serialize()
40
    {
41
        return $this->value;
42
    }
43
}
44

src/Node/FloatNode.php 1 location

@@ 7-43 (lines=37) @@
4
5
namespace Saxulum\ElasticSearchQueryBuilder\Node;
6
7
final class FloatNode extends AbstractNode
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
    public static function create(float $value = null, bool $allowSerializeEmpty = false): FloatNode
20
    {
21
        $node = new self;
22
        $node->value = $value;
23
        $node->allowSerializeEmpty = $allowSerializeEmpty;
24
25
        return $node;
26
    }
27
28
    /**
29
     * @return null
30
     */
31
    public function serializeEmpty()
32
    {
33
        return;
34
    }
35
36
    /**
37
     * @return float|null
38
     */
39
    public function serialize()
40
    {
41
        return $this->value;
42
    }
43
}
44

src/Node/IntNode.php 1 location

@@ 7-43 (lines=37) @@
4
5
namespace Saxulum\ElasticSearchQueryBuilder\Node;
6
7
final class IntNode extends AbstractNode
8
{
9
    /**
10
     * @var int|null
11
     */
12
    private $value;
13
14
    /**
15
     * @param int|null $value
16
     * @param bool $allowSerializeEmpty
17
     * @return IntNode
18
     */
19
    public static function create(int $value = null, bool $allowSerializeEmpty = false): IntNode
20
    {
21
        $node = new self;
22
        $node->value = $value;
23
        $node->allowSerializeEmpty = $allowSerializeEmpty;
24
25
        return $node;
26
    }
27
28
    /**
29
     * @return null
30
     */
31
    public function serializeEmpty()
32
    {
33
        return;
34
    }
35
36
    /**
37
     * @return int|null
38
     */
39
    public function serialize()
40
    {
41
        return $this->value;
42
    }
43
}
44

src/Node/StringNode.php 1 location

@@ 7-43 (lines=37) @@
4
5
namespace Saxulum\ElasticSearchQueryBuilder\Node;
6
7
final class StringNode extends AbstractNode
8
{
9
    /**
10
     * @var string|null
11
     */
12
    private $value;
13
14
    /**
15
     * @param string|null $value
16
     * @param bool $allowSerializeEmpty
17
     * @return StringNode
18
     */
19
    public static function create(string $value = null, bool $allowSerializeEmpty = false): StringNode
20
    {
21
        $node = new self;
22
        $node->value = $value;
23
        $node->allowSerializeEmpty = $allowSerializeEmpty;
24
25
        return $node;
26
    }
27
28
    /**
29
     * @return null
30
     */
31
    public function serializeEmpty()
32
    {
33
        return;
34
    }
35
36
    /**
37
     * @return string|null
38
     */
39
    public function serialize()
40
    {
41
        return $this->value;
42
    }
43
}
44