IsProtected::evaluate()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 1
1
<?php
2
3
namespace Psecio\Invoke\Match\Resource;
4
5
class IsProtected extends \Psecio\Invoke\MatchInstance
6
{
7
	/**
8
	 * Evaluate the provided resource to see if it's marked as protected
9
	 *
10
	 * @param \Psecio\Invoke\Resource $data Resource instance
11
	 * @return boolean Pass/fail status
12
	 */
13
	public function evaluate($data)
14
	{
15
		$setting = $this->getConfig('data');
16
		return (strtolower($setting) === 'on' && $data->user->isAuthed());
0 ignored issues
show
Bug introduced by
The property user 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...
17
	}
18
}