Completed
Push — master ( 65906b...52eeac )
by Beniamin
03:30
created

InExpression::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 5
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 5
loc 5
rs 9.4285
cc 1
eloc 3
nc 1
nop 2
1
<?php
2
3
namespace Phuria\QueryBuilder\Expression;
4
5
/**
6
 * @author Beniamin Jonatan Šimko <[email protected]>
7
 */
8 View Code Duplication
class InExpression implements ExpressionInterface
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...
9
{
10
    /**
11
     * @var ExpressionInterface $wrappedExpression
12
     */
13
    private $wrappedExpression;
14
15
    /**
16
     * @var ExpressionInterface $arguments
17
     */
18
    private $arguments;
19
20
    /**
21
     * @param ExpressionInterface $expression
22
     * @param ExpressionInterface $arguments
23
     */
24
    public function __construct(ExpressionInterface $expression, ExpressionInterface $arguments)
25
    {
26
        $this->wrappedExpression = $expression;
27
        $this->arguments = $arguments;
28
    }
29
30
    /**
31
     * @inheritdoc
32
     */
33
    public function compile()
34
    {
35
        return $this->wrappedExpression->compile() . ' IN (' . $this->arguments->compile(', ') . ')';
0 ignored issues
show
Unused Code introduced by
The call to ExpressionInterface::compile() has too many arguments starting with ', '.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
36
    }
37
}