Completed
Push — master ( 5a3b36...5d92a3 )
by Peter
25:03
created

PreFilter::filter()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 12
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 12
rs 9.4285
cc 3
eloc 6
nc 3
nop 3
1
<?php
2
3
/*
4
 * To change this license header, choose License Headers in Project Properties.
5
 * To change this template file, choose Tools | Templates
6
 * and open the template in the editor.
7
 */
8
9
namespace Maslosoft\Signals\Helpers;
10
11
use Maslosoft\Signals\Interfaces\PreFilterInterface;
12
use Maslosoft\Signals\Interfaces\SignalInterface;
13
use Maslosoft\Signals\Signal;
14
15
/**
16
 * PreFilter
17
 *
18
 * @author Piotr Maselkowski <pmaselkowski at gmail.com>
19
 */
20
class PreFilter
21
{
22
23
	public static function filter(Signal $signals, $fqn, SignalInterface $signal)
24
	{
25
		$preFilters = $signals->getFilters(PreFilterInterface::class);
26
		foreach ($preFilters as $filter)
27
		{
28
			if (!$filter->filter($fqn, $signal))
0 ignored issues
show
Unused Code introduced by
The call to PostFilterInterface::filter() has too many arguments starting with $signal.

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...
29
			{
30
				return false;
31
			}
32
		}
33
		return true;
34
	}
35
36
}
37