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...
20
{
21
/**
22
* @var ResultModifier[]
23
*/
24
private $children;
25
26
/**
27
* Construct it with one or more instances of ResultModifier.
28
*/
29
public function __construct()
30
{
31
// NEXT_MAJOR: use variable-length argument lists (...$children)
32
$this->children = func_get_args();
33
}
34
35
/**
36
* @param AbstractQuery $query
37
*/
38
public function modify(AbstractQuery $query)
39
{
40
foreach ($this->children as $child) {
41
if (!$child instanceof ResultModifier) {
42
throw new InvalidArgumentException(sprintf(
43
'Child passed to ResultModifierCollection must be an instance of %s, but instance of %s found',
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.