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.

NewExpression::unserializeData()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

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