fruffl icon

Link Signal-Slot

fruffl | 01/26/13 04:09:14 PM UTC | 0 ⭐ | 281 👁️ | Never ⏰ | []
PHP |

1.79 KB

|

None

|

0 👍

/

0 👎

    class bar extends \ILLI\Net\Message {}
    class foo extends \ILLI\Net\Message {}
    class bob extends \ILLI\Net\Message {}
    class baz extends \ILLI\Core\StaticObject
    {
        protected static $__autoConfig = ['username'];
        protected static $username = NULL;
        public static function reseiveMyWorld($property, $value)
        {
            return static::aspectable(__FUNCTION__, get_defined_vars(), function($property, $value)
            {
                static::$baz = [__METHOD__ => get_defined_vars()];
                return get_defined_vars();
            });
        }
        public static function aspectableSetUsername($value)
        {
            static::$username = $value;
        }
    }
    
    $foo = new foo;
    $bar = new bar;
    $bob = new bob;
    
    baz::construct();
    baz::registerSignal('aspectableSetUsername', baz::T_SIGNAL_EMIT_EVENT_INIT, 499, [$bob, 'propertySet']);
    
        $foo->registerSignal('aspectableSetUsername', bar::T_SIGNAL_EMIT_EVENT_INIT, 500, [$bar, 'propertySet']);
        $foo->registerSignal('propertySet', bar::T_SIGNAL_EMIT_EVENT_INIT, 500, [$bob, 'propertySet']);
    
        $foo->scheme    = 'http';
        $foo->host  = 'localfrost';
        $foo->username  = 'fruffl';
        $foo->password  = '12345';
        
    baz::propertySet('username', 'foooooooooooooooo');
    
    var_dump($foo->propertyCompact(['username', 'host']));
    var_dump($bar->propertyCompact(['username', 'host']));
    var_dump($bob->propertyCompact(['username', 'host']));
    var_dump(baz::propertyCompact(['username']));
 
 
/*
array(2) {
  ["username"]=>
  string(6) "fruffl"
  ["host"]=>
  string(10) "localfrost"
}
array(2) {
  ["username"]=>
  string(6) "fruffl"
  ["host"]=>
  string(9) "localhost"
}
array(2) {
  ["username"]=>
  string(17) "foooooooooooooooo"
  ["host"]=>
  string(10) "localfrost"
}
array(1) {
  ["username"]=>
  string(17) "foooooooooooooooo"
}

Comments