Пример #1
0
}
if ($success) {
    echo "Success:\n\n";
    var_dump($result);
    echo "\n";
} else {
    echo "Failure...\n";
}
echo "Set Intersection -> ";
$success = true;
$testSet = $otherTestSet = $testArray = $result = null;
try {
    $testSet = Types\Set::build(array(1, 2, 3, 4, 5));
    $otherTestSet = Types\Set::build(array(3, 4, 5));
    $testArray = array(3, 4);
    $result = Types\Set::intersection($testSet, $otherTestSet, $testArray);
} catch (\Exception $e) {
    $success = false;
}
if ($success) {
    echo "Success:\n\n";
    var_dump($result);
    echo "\n";
} else {
    echo "Failure...\n";
}
echo "Set Difference -> ";
$success = true;
$testSet = $otherTestSet = $testArrray = $result = null;
try {
    $testSet = Types\Set::build(array(1, 2, 3, 4, 5, 6));
Пример #2
0
 /**
  * Takes an event and compares it against the filter
  * 
  * If it matches on one account, the event is propagated
  * 
  * If this object is 'strict' we call strictlyApplicable instead
  * 
  * @param Falcraft\Event\Resource\AbstractEvent
  * 
  * @return bool
  * 
  */
 public function isLooselyApplicable(EventResource\AbstractEvent $event)
 {
     if ($this->getIdentifier() == $event->getIdentifier()) {
         return true;
     }
     if (!$this->target && !$this->function && !$this->class && !$this->namespace && $this->tags->isEmpty() && $this->categories->isEmpty()) {
         return true;
     }
     if ($this->target && $this->target == $event->getTarget() || $this->function && $this->function == $event->getFunction() || $this->class && $this->class == $event->getClass() || $this->namespace && $this->namespace == $event->getNamespace() || Types\Set::intersection($this->tags, $event->getTagsObject()) || Types\Set::intersection($this->categories, $event->getCategoriesObject())) {
         return true;
     }
     return false;
 }