diff options
author | Anton Luka Šijanec <anton@sijanec.eu> | 2024-05-27 13:08:29 +0200 |
---|---|---|
committer | Anton Luka Šijanec <anton@sijanec.eu> | 2024-05-27 13:08:29 +0200 |
commit | 75160b12821f7f4299cce7f0b69c83c1502ae071 (patch) | |
tree | 27e25e4ccaef45f0c58b22831164050d1af1d4db /vendor/minishlink/web-push/src/Notification.php | |
parent | prvi-commit (diff) | |
download | 1ka-75160b12821f7f4299cce7f0b69c83c1502ae071.tar 1ka-75160b12821f7f4299cce7f0b69c83c1502ae071.tar.gz 1ka-75160b12821f7f4299cce7f0b69c83c1502ae071.tar.bz2 1ka-75160b12821f7f4299cce7f0b69c83c1502ae071.tar.lz 1ka-75160b12821f7f4299cce7f0b69c83c1502ae071.tar.xz 1ka-75160b12821f7f4299cce7f0b69c83c1502ae071.tar.zst 1ka-75160b12821f7f4299cce7f0b69c83c1502ae071.zip |
Diffstat (limited to 'vendor/minishlink/web-push/src/Notification.php')
-rw-r--r-- | vendor/minishlink/web-push/src/Notification.php | 172 |
1 files changed, 86 insertions, 86 deletions
diff --git a/vendor/minishlink/web-push/src/Notification.php b/vendor/minishlink/web-push/src/Notification.php index 1107404..15d634f 100644 --- a/vendor/minishlink/web-push/src/Notification.php +++ b/vendor/minishlink/web-push/src/Notification.php @@ -1,86 +1,86 @@ -<?php - -declare(strict_types=1); - -/* - * This file is part of the WebPush library. - * - * (c) Louis Lagrange <lagrange.louis@gmail.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Minishlink\WebPush; - -class Notification -{ - /** @var SubscriptionInterface */ - private $subscription; - - /** @var null|string */ - private $payload; - - /** @var array Options : TTL, urgency, topic */ - private $options; - - /** @var array Auth details : GCM, VAPID */ - private $auth; - - /** - * Notification constructor. - * - * @param SubscriptionInterface $subscription - * @param null|string $payload - * @param array $options - * @param array $auth - */ - public function __construct(SubscriptionInterface $subscription, ?string $payload, array $options, array $auth) - { - $this->subscription = $subscription; - $this->payload = $payload; - $this->options = $options; - $this->auth = $auth; - } - - /** - * @return SubscriptionInterface - */ - public function getSubscription(): SubscriptionInterface - { - return $this->subscription; - } - - /** - * @return null|string - */ - public function getPayload(): ?string - { - return $this->payload; - } - - /** - * @param array $defaultOptions - * - * @return array - */ - public function getOptions(array $defaultOptions = []): array - { - $options = $this->options; - $options['TTL'] = array_key_exists('TTL', $options) ? $options['TTL'] : $defaultOptions['TTL']; - $options['urgency'] = array_key_exists('urgency', $options) ? $options['urgency'] : $defaultOptions['urgency']; - $options['topic'] = array_key_exists('topic', $options) ? $options['topic'] : $defaultOptions['topic']; - - return $options; - } - - /** - * @param array $defaultAuth - * - * @return array - */ - public function getAuth(array $defaultAuth): array - { - return count($this->auth) > 0 ? $this->auth : $defaultAuth; - } -} +<?php
+
+declare(strict_types=1);
+
+/*
+ * This file is part of the WebPush library.
+ *
+ * (c) Louis Lagrange <lagrange.louis@gmail.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Minishlink\WebPush;
+
+class Notification
+{
+ /** @var SubscriptionInterface */
+ private $subscription;
+
+ /** @var null|string */
+ private $payload;
+
+ /** @var array Options : TTL, urgency, topic */
+ private $options;
+
+ /** @var array Auth details : GCM, VAPID */
+ private $auth;
+
+ /**
+ * Notification constructor.
+ *
+ * @param SubscriptionInterface $subscription
+ * @param null|string $payload
+ * @param array $options
+ * @param array $auth
+ */
+ public function __construct(SubscriptionInterface $subscription, ?string $payload, array $options, array $auth)
+ {
+ $this->subscription = $subscription;
+ $this->payload = $payload;
+ $this->options = $options;
+ $this->auth = $auth;
+ }
+
+ /**
+ * @return SubscriptionInterface
+ */
+ public function getSubscription(): SubscriptionInterface
+ {
+ return $this->subscription;
+ }
+
+ /**
+ * @return null|string
+ */
+ public function getPayload(): ?string
+ {
+ return $this->payload;
+ }
+
+ /**
+ * @param array $defaultOptions
+ *
+ * @return array
+ */
+ public function getOptions(array $defaultOptions = []): array
+ {
+ $options = $this->options;
+ $options['TTL'] = array_key_exists('TTL', $options) ? $options['TTL'] : $defaultOptions['TTL'];
+ $options['urgency'] = array_key_exists('urgency', $options) ? $options['urgency'] : $defaultOptions['urgency'];
+ $options['topic'] = array_key_exists('topic', $options) ? $options['topic'] : $defaultOptions['topic'];
+
+ return $options;
+ }
+
+ /**
+ * @param array $defaultAuth
+ *
+ * @return array
+ */
+ public function getAuth(array $defaultAuth): array
+ {
+ return count($this->auth) > 0 ? $this->auth : $defaultAuth;
+ }
+}
|