HasParameters::evaluate()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 9
rs 9.9666
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
namespace Psecio\Invoke\Match\Route;
4
5
class HasParameters extends \Psecio\Invoke\MatchInstance
6
{
7
	protected $error = 'Mismatch on parameters';
8
9
	/**
10
	 * Evaluate the parameters on the current route to
11
	 * 	ensure there's a correct match
12
	 *
13
	 * @param array $data Set of context items (user, resource, route)
14
	 * @return boolean Pass/fail status
15
	 */
16
	public function evaluate($data)
17
	{
18
		$params = $data->route->getParams();
19
		$config = $this->getConfig();
20
21
		// Ensure all params match exactly
22
		$intersect = array_intersect($config['data'][0], $params);
23
		return (count($intersect) === count($params));
24
	}
25
}