public function testRules() { $this->assertCount(0, $this->policy->getRules()); $rule = new \Xacmlphp\Rule(); $this->policy->addRule($rule); $this->assertCount(1, $this->policy->getRules()); foreach ($this->policy->getRules() as $rule) { $this->assertInstanceOf('\\Xacmlphp\\Rule', $rule); } }
public function evaluate(array $results, \Xacmlphp\Policy $policy = null) { $rules = $policy->getRules(); if (count($rules) > 0) { $firstRule = array_shift($rules); $firstRuleId = $firstRule->getId(); return array_key_exists($firstRuleId, $results) ? $results[$firstRuleId] : false; } else { return false; } }
public function evaluate(array $results, \Xacmlphp\Policy $policy = null) { $rules = $policy->getRules(); if (count($rules) > 0) { foreach ($rules as $rule) { $firstRuleId = $rule->getId(); if (array_key_exists($firstRuleId, $results) && $results[$firstRuleId] == true) { return true; } } return false; } else { return false; } }