/** * Allowing to emit static events through public variable * * @param string name * @param array of args * @return mixed */ public static function __callStatic($name, $args) { $class = new Nette\Reflection\ClassType(get_called_class()); $properties = $class->getStaticProperties(); if (isset($properties[$name])) { if (is_array($list = $properties[$name]) || $list instanceof \Traversable) { foreach ($list as $handler) { callback($handler)->invokeArgs($args); } } return NULL; } return parent::__callStatic($name, $args); }