PostFilter   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 1
dl 0
loc 17
rs 10
c 0
b 0
f 0
ccs 6
cts 6
cp 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A filter() 0 12 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