Registers JS for PNotify plugin.
@param array $notification configuration array
504345
protected function registerNotification(array $notification)
    {
        $view = $this->getView();

        $options = Json::encode(ArrayHelper::merge($this->getClientOptions(), $notification));
        $view->registerJs("new PNotify({$options});");
    }
1206073
private function append_settings_require_notices( $notices ) {
		if ( count( $this->setting_require ) > 0 ) {
			foreach ( $this->setting_require as $setting => $value ) {
				if ( ! $this->is_setting_set( $setting, $value ) ) {
					$notices[] = $this->prepare_notice_message( sprintf( __( 'The &#8220;%s&#8221; plugin cannot run without %s php setting set to %s. Please contact your host and ask them to set %s.',
						$this->get_text_domain() ), esc_html( $this->plugin_name ), esc_html( basename( $setting ) ),
						esc_html( basename( $value ) ), esc_html( basename( $setting ) ) ) );
				}
			}
		}

		return $notices;
	}
1123923
public function send($notifiable, Notification $notification)
    {
        if (! $to = $notifiable->routeNotificationFor('plivo')) {
            return;
        }

        $message = $notification->toPlivo($notifiable);

        if (is_string($message)) {
            $message = new PlivoMessage($message);
        }

        $response = $this->plivo->send_message([
            'src' => $message->from ?: $this->from,
            'dst' => $to,
            'text' => trim($message->content),
        ]);

        if ($response['status'] !== 202) {
            throw CouldNotSendNotification::serviceRespondedWithAnError($response);
        }

        return $response;
    }
344351
protected function queueNotification($notifiables, $notification)
    {
        $notifiables = $this->formatNotifiables($notifiables);

        $original = clone $notification;

        foreach ($notifiables as $notifiable) {
            $notificationId = Str::uuid()->toString();

            foreach ((array) $original->via($notifiable) as $channel) {
                $notification = clone $original;

                $notification->id = $notificationId;

                if (! is_null($this->locale)) {
                    $notification->locale = $this->locale;
                }

                $this->bus->dispatch(
                    (new SendQueuedNotifications($notifiable, $notification, [$channel]))
                            ->onConnection($notification->connection)
                            ->onQueue($notification->queue)
                            ->delay($notification->delay)
                );
            }
        }
    }
528803
public function notification(array $notification) : array
    {
        try {
            $response = $this->client->post(
                'notices',
                ['body' => json_encode($notification)]
            );
        } catch (Exception $e) {
            throw ServiceException::generic();
        }

        if ($response->getStatusCode() !== Response::HTTP_CREATED) {
            throw (new ServiceExceptionFactory($response))->make();
        }

        return (string) $response->getBody()
            ? json_decode($response->getBody(), true)
            : [];
    }
374580
public function send($notifiable, Notification $notification)
    {
        $message = $notification->toMessagebird($notifiable);

        if (is_string($message)) {
            $message = MessagebirdMessage::create($message);
        }

        if ($to = $notifiable->routeNotificationFor('messagebird')) {
            $message->setRecipients($to);
        }

        $this->client->send($message);
    }
1122935
private function registerNotifyService()
    {
        $this->singleton(Contracts\Notify::class, function ($app) {
            /**  @var \Illuminate\Config\Repository  $config  */
            $config = $app['config'];

            return new Notify(
                $app[Contracts\SessionStore::class],
                $config->get('notify.session.prefix', 'notifier')
            );
        });
    }
54929
protected function buildMessage($notifiable, Notification $notification)
    {
        $message = call_user_func_array([$notification, $this->getToMethod()], [$notifiable]);

        if (is_string($message)) {
            $message = new PushMessage($message);
        }

        return $message;
    }
1190807
protected function render_notification(\core\output\notification $notification) {
        return $this->render_from_template($notification->get_template_name(), $notification->export_for_template($this));
    }
382932
public function send($notifiable, Notification $notification)
    {
        $message = $notification->toSlack();

        $this->http->post($notifiable, $this->buildJsonPayload($message));
    }
1096841
public function sendNotifications($notification_type, array $args = [])
    {
        if (!isset($this->_notifications[$notification_type])) {
            // No exception thrown and error logged since this method will be called from
            // within the SDK
            return;
        }

        /**
         * Note: Before PHP 7, if the callback in call_user_func is called with less number of arguments than expected,
         * a warning is issued but the method is still executed with assigning null to the remaining
         * arguments. From PHP 7, ArgumentCountError is thrown in such case and the method isn't executed.
         * Therefore, we set error handler for warnings so that we raise an exception and notify the
         * user that the registered callback has more number of arguments than
         * expected. This should be done to keep a consistent behavior across all PHP versions.
         */

        set_error_handler(array($this, 'reportArgumentCountError'), E_WARNING);

        foreach (array_values($this->_notifications[$notification_type]) as $callback) {
            try {
                call_user_func_array($callback, $args);
            } catch (ArgumentCountError $e) {
                $this->reportArgumentCountError();
            } catch (Exception $e) {
                $this->_logger->log(Logger::ERROR, "Problem calling notify callback.");
            }
        }

        restore_error_handler();
    }
89368
def register(**kwargs):
    

    def _wrapper(notification_cls):

        if not issubclass(notification_cls, (Notification,)):
            raise RegisterNotificationError(
                f"Wrapped class must be a 'Notification' class. "
                f"Got '{notification_cls.__name__}'"
            )
        site_notifications.register(notification_cls=notification_cls)
        return notification_cls

    return _wrapper
1178014
private function prepareHandle(Notification $notification)
    {
        $request = new Request($notification, $this->isProductionEnv);
        $ch = curl_init();

        $this->authProvider->authenticateClient($request);

        curl_setopt_array($ch, $request->getOptions());
        curl_setopt($ch, CURLOPT_HTTPHEADER, $request->getDecoratedHeaders());

        // store device token to identify response
        curl_setopt($ch, CURLOPT_PRIVATE, $notification->getDeviceToken());

        return $ch;
    }
1041084
public function send($notifiables, $notification)
    {
        $notifiables = $this->formatNotifiables($notifiables);

        if (! $notification instanceof ShouldQueueInterface) {
            return $this->sendNow($notifiables, $notification);
        }

        foreach ($notifiables as $notifiable) {
            $notificationId = Uuid::uuid4()->toString();

            foreach ($notification->via($notifiable) as $channel) {
                $this->queueToNotifiable($notifiable, $notificationId, clone $notification, $channel);
            }
        }
    }
920487
public function addNotifiableNotification(NotifiableNotification $notifiableNotification)
    {
        if (!$this->notifiableNotifications->contains($notifiableNotification)) {
            $this->notifiableNotifications[] = $notifiableNotification;
            $notifiableNotification->setNotifiableEntity($this);
        }

        return $this;
    }
521321
def register(self, notification_cls=None):
        
        self.loaded = True
        display_names = [n.display_name for n in self.registry.values()]
        if (
            notification_cls.name not in self.registry
            and notification_cls.display_name not in display_names
        ):
            self.registry.update({notification_cls.name: notification_cls})

            models = getattr(notification_cls, "models", [])
            if not models and getattr(notification_cls, "model", None):
                models = [getattr(notification_cls, "model")]
            for model in models:
                try:
                    if notification_cls.name not in [
                        n.name for n in self.models[model]
                    ]:
                        self.models[model].append(notification_cls)
                except KeyError:
                    self.models.update({model: [notification_cls]})
        else:
            raise AlreadyRegistered(
                f"Notification {notification_cls.name}: "
                f"{notification_cls.display_name} is already registered."
            )
638060
public function registerClientScript()
    {
    	$view = $this->getView();
    	PNotifyAsset::register($view);

    	$options = empty($this->pluginOptions) ? '' : Json::encode($this->pluginOptions);
    	$js = "new PNotify(".$options.");";

    	$view->registerJs($js);
    }