コード例 #1
0
 /**
  * Sends notification.
  *
  * @param string $action The name of the notifier action to trigger.
  * @param array $args Arguments to pass to the triggered notifier action.
  * @return array
  * @throws \CvoTechnologies\Notifier\Exception\MissingActionException
  * @throws \BadMethodCallException
  */
 public function send($action, $args = [])
 {
     if (!method_exists($this, $action)) {
         throw new MissingActionException(['notifier' => $this->getName() . 'Notifier', 'action' => $action]);
     }
     if (!$this->_notification->viewBuilder()->template()) {
         $this->_notification->viewBuilder()->template($action);
     }
     call_user_func_array([$this, $action], $args);
     $result = $this->_notification->send();
     $this->reset();
     return $result;
 }