Passed
Push — master ( b26d44...e096d1 )
by
unknown
01:42
created

QueryVar::getArguments()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 3
ccs 0
cts 2
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 1
crap 2
1
<?php
2
3
namespace CarbonFramework\Routing\Conditions;
4
5
use CarbonFramework\Request;
6
7
/**
8
 * Check against the current post's type
9
 */
10
class QueryVar implements ConditionInterface {
11
	/**
12
	 * Query var name to check against
13
	 *
14
	 * @var string
15
	 */
16
	protected $query_var_name = '';
17
18
	/**
19
	 * Query var value to check against
20
	 *
21
	 * @var string
22
	 */
23
	protected $query_var = '';
24
25
	/**
26
	 * Constructor
27
	 *
28
	 * @param string $query_var
29
	 */
30
	public function __construct( $query_var_name, $query_var ) {
31
		$this->query_var_name = $query_var_name;
32
		$this->query_var = $query_var;
33
	}
34
35
	/**
36
	 * {@inheritDoc}
37
	 */
38
	public function satisfied( Request $request ) {
39
		return $this->query_var === get_query_var( $this->query_var_name );
40
	}
41
42
	/**
43
	 * {@inheritDoc}
44
	 */
45
	public function getArguments( Request $request ) {
46
		return [$this->query_var_name, $this->query_var];
47
	}
48
}
49