Passed
Push — master ( 4e8eae...431198 )
by
unknown
01:42
created

Multiple::satisfied()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 12

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 8
ccs 0
cts 5
cp 0
rs 9.4285
cc 3
eloc 5
nc 3
nop 1
crap 12
1
<?php
2
3
namespace CarbonFramework\Routing\Conditions;
4
5
use CarbonFramework\Request;
6
7
/**
8
 * Check against a custom callable
9
 */
10
class Multiple implements ConditionInterface {
11
	/**
12
	 * Array of conditions to check
13
	 *
14
	 * @var array<ConditionInterface>
15
	 */
16
	protected $conditions = [];
17
18
	/**
19
	 * Constructor
20
	 *
21
	 * @param array $conditions
22
	 */
23
	public function __construct( $conditions ) {
24
		$this->conditions = array_map( [Factory::class, 'make'], $conditions );
25
	}
26
27
	/**
28
	 * {@inheritDoc}
29
	 */
30
	public function satisfied( Request $request ) {
31
		foreach ( $this->conditions as $condition ) {
32
			if ( ! $condition->satisfied( $request ) ) {
33
				return false;
34
			}
35
		}
36
		return true;
37
	}
38
39
	/**
40
	 * {@inheritDoc}
41
	 */
42
	public function getArguments( Request $request ) {
43
		return [];
44
	}
45
}
46