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...
27
{
28
foreach ($arguments as $argument) {
29
if (!$argument instanceof TokenInterface) {
30
$argument = new ExactValueToken($argument);
31
}
32
$this->tokens[] = $argument;
33
}
34
}
35
36
/**
37
* Scores maximum score from scores returned by tokens for this argument if all of them score.
38
*
39
* @param $argument
40
*
41
* @return bool|int
42
*/
43
public function scoreArgument($argument)
44
{
45
if (0 === count($this->tokens)) {
46
return false;
47
}
48
49
$maxScore = 0;
50
foreach ($this->tokens as $token) {
51
$score = $token->scoreArgument($argument);
52
if (false === $score) {
53
return false;
54
}
55
$maxScore = max($score, $maxScore);
56
}
57
58
return $maxScore;
59
}
60
61
/**
62
* Returns false.
63
*
64
* @return boolean
65
*/
66
public function isLast()
67
{
68
return false;
69
}
70
71
/**
72
* Returns string representation for token.
73
*
74
* @return string
75
*/
76
public function __toString()
77
{
78
return sprintf('bool(%s)', implode(' AND ', $this->tokens));
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.