Completed
Branch master (9de2b1)
by Dominik
03:28 queued 01:13
created

CallbackNode   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getDefault() 0 4 1
A serialize() 0 6 1
1
<?php
2
3
namespace Saxulum\ElasticSearchQueryBuilder\Node;
4
5
class CallbackNode extends AbstractNode
6
{
7
    /**
8
     * @var \Closure
9
     */
10
    protected $callback;
11
12
    /**
13
     * @param \Closure $callback
14
     * @param bool     $allowAddDefault
0 ignored issues
show
Bug introduced by
There is no parameter named $allowAddDefault. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
15
     */
16
    public function __construct(\Closure $callback)
17
    {
18
        $this->callback = $callback;
19
    }
20
21
    /**
22
     */
23
    public function getDefault()
24
    {
25
        return;
26
    }
27
28
    /**
29
     * @return \stdClass|array|string|float|int|bool|null
30
     */
31
    public function serialize()
32
    {
33
        $callback = $this->callback;
34
35
        return $callback();
36
    }
37
}
38