Exemplo n.º 1
0
    $testArray = array(1);
    $result = Types\Set::difference($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 Subset: \n";
$testSet = $otherTestSet = $anotherTestSet = null;
try {
    $testSet = Types\Set::build(array(1, 2, 3, 4, 5));
    $otherTestSet = Types\Set::build(array(2, 3, 4));
    $anotherTestSet = Types\Set::build(array(4, 5, 6));
    if (Types\Set::subset($testSet, $otherTestSet)) {
        echo "    otherTestSet Is a Subset of testSet\n";
    } else {
        echo "    otherTestSet Is NOT a Subset of testSet\n";
    }
    if (Types\Set::subset($testSet, $anotherTestSet)) {
        echo "    anotherTestSet Is a Subset of testSet\n";
    } else {
        echo "    anotherTestSet Is NOT a Subset of testSet\n";
    }
} catch (\Exception $e) {
    echo "EXCEPTION CAUGHT\n";
}
Exemplo n.º 2
0
 /**
  * See if an event matches the filter exactly
  * 
  * If one thing doesn't match between the event and the filter
  * then we return false, instead of only one thing matching
  * 
  * @param Falcraft\Event\Resource\AbstractEvent $event
  *      The event to compare
  * 
  * @return bool
  * 
  */
 public function isStrictlyApplicable(EventResource\AbstractEvent $event, $includeIdentifier = false)
 {
     if ($includeIdentifier) {
         if ($this->identifier != $event->getIdentifier()) {
             return false;
         }
     }
     if ($this->target != $event->getTarget() || $this->function != $event->getFunction() || $this->class != $event->getClass() || $this->namespace != $event->getNamespace() || !Types\Set::subset($event->getTagsObject(), $this->tags) || !Types\Set::subset($event->getCategoriesObject(), $this->categories)) {
         return false;
     }
     return true;
 }