GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

FunctionCallExpression::compileCode()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 12
Code Lines 8

Duplication

Lines 12
Ratio 100 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 12
loc 12
rs 9.4285
cc 2
eloc 8
nc 2
nop 1
1
<?php
2
3
namespace Pinq\Expressions;
4
5
/**
6
 * <code>
7
 * strlen($I)
8
 * </code>
9
 *
10
 * @author Elliot Levin <[email protected]>
11
 */
12
class FunctionCallExpression extends Expression
13
{
14
    /**
15
     * @var Expression
16
     */
17
    private $name;
18
19
    /**
20
     * @var ArgumentExpression[]
21
     */
22
    private $arguments;
23
24
    public function __construct(Expression $nameExpression, array $argumentExpressions = [])
25
    {
26
        $this->name      = $nameExpression;
27
        $this->arguments = self::verifyAll($argumentExpressions, ArgumentExpression::getType());
28
    }
29
30
    /**
31
     * @return Expression
32
     */
33
    public function getName()
34
    {
35
        return $this->name;
36
    }
37
38
    /**
39
     * @return ArgumentExpression[]
40
     */
41
    public function getArguments()
42
    {
43
        return $this->arguments;
44
    }
45
46
    public function traverse(ExpressionWalker $walker)
47
    {
48
        return $walker->walkFunctionCall($this);
49
    }
50
51
    /**
52
     * @param Expression           $name
53
     * @param ArgumentExpression[] $arguments
54
     *
55
     * @return self
56
     */
57 View Code Duplication
    public function update(Expression $name, array $arguments = [])
0 ignored issues
show
Duplication introduced by
This method 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...
58
    {
59
        if ($this->name === $name
60
                && $this->arguments === $arguments
61
        ) {
62
            return $this;
63
        }
64
65
        return new self($name, $arguments);
66
    }
67
68 View Code Duplication
    protected function compileCode(&$code)
0 ignored issues
show
Duplication introduced by
This method 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...
69
    {
70
        if ($this->name instanceof ValueExpression) {
71
            $code .= $this->name->getValue();
72
        } else {
73
            $this->name->compileCode($code);
74
        }
75
76
        $code .= '(';
77
        $code .= implode(',', self::compileAll($this->arguments));
78
        $code .= ')';
79
    }
80
81
    public function serialize()
82
    {
83
        return serialize([$this->name, $this->arguments]);
84
    }
85
86
    public function unserialize($serialized)
87
    {
88
        list($this->name, $this->arguments) = unserialize($serialized);
89
    }
90
91
    public function __clone()
92
    {
93
        $this->name      = clone $this->name;
94
        $this->arguments = self::cloneAll($this->arguments);
95
    }
96
}
97