HasParameters   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 1
dl 0
loc 21
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A evaluate() 0 9 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
}