Esempio n. 1
1
 public function handlerStatus()
 {
     $fmt = 'Class[%s] %s[%s]';
     error_log("\nCosts:");
     error_log("Main Cost Class[" . Costs::getMainCost() . ']');
     foreach (Costs::getClasses() as $class) {
         error_log(sprintf($fmt, $class, 'Cost', $class::getMaxCost()));
     }
     error_log("\nQualifiers:");
     foreach (Qualifiers::getClasses() as $class) {
         error_log(sprintf($fmt, $class, 'Weight', $class::getWeight()));
     }
     error_log("\nRules Free Of Context:");
     foreach (RulesFreeOfContext::getClasses() as $class) {
         error_log(sprintf($fmt, $class, 'isValid', $class::isEnable()));
     }
     error_log("\nRules Sensitive To The Context:");
     foreach (RulesSensitiveToTheContext::getClasses() as $class) {
         error_log(sprintf($fmt, $class, 'isValid', $class::isEnable()));
     }
     echo PHP_EOL;
 }
 public static function isAllowed($cvmp)
 {
     $rules = RulesSensitiveToTheContext::getClasses();
     foreach ($rules as $class) {
         $allowed = $class::isAllowed($cvmp);
         $isEnable = $class::isEnable();
         if ($isEnable and !$allowed) {
             return false;
         }
     }
     return true;
 }
Esempio n. 3
0
 /**
  * @ depends testQUAextimp
  * @ expectedException Exception
  */
 public function setUp()
 {
     foreach (Costs::getClasses() as $class) {
         Costs::del($class);
     }
     foreach (Qualifiers::getClasses() as $class) {
         Qualifiers::del($class);
     }
     foreach (RulesFreeOfContext::getClasses() as $class) {
         RulesFreeOfContext::del($class);
     }
     foreach (RulesSensitiveToTheContext::getClasses() as $class) {
         RulesSensitiveToTheContext::del($class);
     }
 }