PostFilter::filter()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 12

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 3

Importance

Changes 0
Metric Value
dl 0
loc 12
rs 9.8666
c 0
b 0
f 0
ccs 6
cts 6
cp 1
cc 3
nc 3
nop 3
crap 3
1
<?php
2
3
/**
4
 * This software package is licensed under `AGPL-3.0-only, proprietary` license[s].
5
 *
6
 * @package maslosoft/signals
7
 * @license AGPL-3.0-only, proprietary
8
 *
9
 * @copyright Copyright (c) Peter Maselkowski <[email protected]>
10
 * @link https://maslosoft.com/signals/
11
 */
12
13
namespace Maslosoft\Signals\Helpers;
14
15
use Maslosoft\Signals\Interfaces\PostFilterInterface;
16
use Maslosoft\Signals\Signal;
17
18
/**
19
 * PostFilter
20
 *
21
 * @author Piotr Maselkowski <pmaselkowski at gmail.com>
22
 */
23
class PostFilter
24
{
25
26 21
	public static function filter(Signal $signals, $injected, $signal)
27
	{
28 21
		$filters = $signals->getFilters(PostFilterInterface::class);
29 21
		foreach ($filters as $filter)
30
		{
31 4
			if (!$filter->filter($injected, $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...
32
			{
33 4
				return false;
34
			}
35
		}
36 17
		return true;
37
	}
38
39
}
40