Example #1
0
 /**
  * The Handler Constructor
  * 
  * This takes a destination (presumably an object, where our
  * code is going to GO [forward]), a function/method name and some
  * options
  * 
  * @param object $destination The destination object
  * @param string $function The function/method name to be called
  * @param string $namespace The namespace definition of the destination
  * @param int $priority The priority 
  * 
  */
 public function __construct($destination, $function, $namespace, $priority = self::DEFAULT_PRIORITY, $options = array())
 {
     if (is_array($options)) {
         $options = array_change_key_case($options);
     }
     $options = array_merge(array('strict' => true), $options);
     $this->configure($options);
     parent::__construct($this, $priority, $options);
     $this->object = $destination;
     $this->function = $function;
     $this->namespace = $namespace;
     $restrictions = new Types\Restrictions(array(Type::BASIC_NULL, Type::TYPED_OBJECT), array('Falcraft\\Patterns\\Resource\\PublisherInterface'), array('strict' => true));
     $this->subject = new Types\RestrictedSet(array(), $restrictions, array('strict' => $this->conf->strict));
 }
Example #2
0
    $obj = new testClass();
    $obj->publicProp = 'data';
    $testPriority = new Types\Priority($obj);
    $r = $testPriority->getData();
} catch (\Exception $e) {
    $success = false;
}
if ($success) {
    echo "Success!\n\n";
    echo "Priority Internals -- \n\n";
    var_dump($testPriority);
    echo "\n";
    var_dump($r);
    echo "\n";
} else {
    echo "Failure...\n";
}
echo "Testing Priority Property -> ";
$success = true;
$testPriority = $p = null;
try {
    $testPriority = new Types\Priority('data', 5);
    $p = $testPriority->getPriority();
} catch (\Exception $e) {
    $success = false;
}
if ($success) {
    echo "Success! Priority: {$p}\n";
} else {
    echo "Failure...\n";
}