Пример #1
0
 /**
  * Provides a static interface for event dispatcher's dynamic methods
  *
  * @param  string $name method name
  * @param  array $arguments arguments
  * @return mixed
  * @throws BadMethodCallException if method not found
  * @access public
  * @static
  * @internal
  */
 public static function __callStatic($name, array $arguments)
 {
     $mgr = static::getEventManager();
     if (method_exists($mgr, $name)) {
         return call_user_func_array([$mgr, $name], $arguments);
     }
     throw new BadMethodCallException(Message::get(Message::MSG_METHOD_NOTFOUND, $name, get_called_class()), Message::MSG_METHOD_NOTFOUND);
 }
Пример #2
0
 /**
  * {@inheritDoc}
  */
 public function setName($name)
 {
     if (!is_string($name) || empty($name)) {
         throw new InvalidArgumentException(Message::get(Message::EVT_NAME_INVALID, $name), Message::EVT_NAME_INVALID);
     }
     $this->name = $name;
 }