HasMethod   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 2
dl 0
loc 20
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A evaluate() 0 8 2
1
<?php
2
3
namespace Psecio\Invoke\Match\Resource;
4
5
class HasMethod extends \Psecio\Invoke\MatchInstance
6
{
7
	protected $error = 'Mismatch on HTTP method :data';
8
9
	/**
10
	 * Evaluate the provided resource to see if it's in the allowed
11
	 * 	set of HTTP methods
12
	 *
13
	 * @param \Psecio\Invoke\Resource $data Resource instance
14
	 * @return boolean Pass/fail status
15
	 */
16
	public function evaluate($data)
17
	{
18
		$resource = $data->resource;
0 ignored issues
show
Bug introduced by
The property resource does not seem to exist in Psecio\Invoke\Resource.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
19
		$httpMethod = ($resource instanceof \Psecio\Invoke\Resource)
20
			? $resource->getHttpMethod() : $resource;
21
22
		return (in_array(strtolower($httpMethod), $this->getConfig('data')));
23
	}
24
}