diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml
index 4ee16844..ffb8a097 100644
--- a/.github/workflows/linter.yml
+++ b/.github/workflows/linter.yml
@@ -11,7 +11,9 @@ jobs:
uses: actions/checkout@v3
with:
fetch-depth: 2
+
- run: git checkout HEAD^2
+
- name: Run Linter
run: |
docker run --rm -v $PWD:/app composer sh -c \
diff --git a/composer.json b/composer.json
index e94220b3..4025264c 100644
--- a/composer.json
+++ b/composer.json
@@ -7,8 +7,8 @@
"minimum-stability": "stable",
"scripts": {
"test": "vendor/bin/phpunit",
- "lint": "vendor/bin/phpcs",
- "format": "vendor/bin/phpcbf"
+ "lint": "./vendor/bin/pint --test",
+ "format": "./vendor/bin/pint"
},
"authors": [
{
@@ -34,7 +34,7 @@
"require-dev": {
"phpunit/phpunit": "9.5.*",
"phpmailer/phpmailer": "6.6.*",
- "squizlabs/php_codesniffer": "^3.6"
+ "laravel/pint": "^1.2"
},
"config": {
"platform": {
diff --git a/composer.lock b/composer.lock
index 88f16b81..c2118454 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
- "content-hash": "e33a07c2dd4a4d32669369f3e04a7a21",
+ "content-hash": "1ca9da311c804e40032e90c09ad04d76",
"packages": [],
"packages-dev": [
{
@@ -77,6 +77,72 @@
],
"time": "2022-03-03T08:28:38+00:00"
},
+ {
+ "name": "laravel/pint",
+ "version": "v1.2.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/laravel/pint.git",
+ "reference": "1d276e4c803397a26cc337df908f55c2a4e90d86"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/laravel/pint/zipball/1d276e4c803397a26cc337df908f55c2a4e90d86",
+ "reference": "1d276e4c803397a26cc337df908f55c2a4e90d86",
+ "shasum": ""
+ },
+ "require": {
+ "ext-json": "*",
+ "ext-mbstring": "*",
+ "ext-tokenizer": "*",
+ "ext-xml": "*",
+ "php": "^8.0"
+ },
+ "require-dev": {
+ "friendsofphp/php-cs-fixer": "^3.11.0",
+ "illuminate/view": "^9.27",
+ "laravel-zero/framework": "^9.1.3",
+ "mockery/mockery": "^1.5.0",
+ "nunomaduro/larastan": "^2.2",
+ "nunomaduro/termwind": "^1.14.0",
+ "pestphp/pest": "^1.22.1"
+ },
+ "bin": [
+ "builds/pint"
+ ],
+ "type": "project",
+ "autoload": {
+ "psr-4": {
+ "App\\": "app/",
+ "Database\\Seeders\\": "database/seeders/",
+ "Database\\Factories\\": "database/factories/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Nuno Maduro",
+ "email": "enunomaduro@gmail.com"
+ }
+ ],
+ "description": "An opinionated code formatter for PHP.",
+ "homepage": "https://laravel.com",
+ "keywords": [
+ "format",
+ "formatter",
+ "lint",
+ "linter",
+ "php"
+ ],
+ "support": {
+ "issues": "https://github.com/laravel/pint/issues",
+ "source": "https://github.com/laravel/pint"
+ },
+ "time": "2022-09-13T15:07:15+00:00"
+ },
{
"name": "myclabs/deep-copy",
"version": "1.11.0",
@@ -1765,62 +1831,6 @@
],
"time": "2020-09-28T06:39:44+00:00"
},
- {
- "name": "squizlabs/php_codesniffer",
- "version": "3.7.1",
- "source": {
- "type": "git",
- "url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
- "reference": "1359e176e9307e906dc3d890bcc9603ff6d90619"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/1359e176e9307e906dc3d890bcc9603ff6d90619",
- "reference": "1359e176e9307e906dc3d890bcc9603ff6d90619",
- "shasum": ""
- },
- "require": {
- "ext-simplexml": "*",
- "ext-tokenizer": "*",
- "ext-xmlwriter": "*",
- "php": ">=5.4.0"
- },
- "require-dev": {
- "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0"
- },
- "bin": [
- "bin/phpcs",
- "bin/phpcbf"
- ],
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "3.x-dev"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "BSD-3-Clause"
- ],
- "authors": [
- {
- "name": "Greg Sherwood",
- "role": "lead"
- }
- ],
- "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.",
- "homepage": "https://github.com/squizlabs/PHP_CodeSniffer",
- "keywords": [
- "phpcs",
- "standards"
- ],
- "support": {
- "issues": "https://github.com/squizlabs/PHP_CodeSniffer/issues",
- "source": "https://github.com/squizlabs/PHP_CodeSniffer",
- "wiki": "https://github.com/squizlabs/PHP_CodeSniffer/wiki"
- },
- "time": "2022-06-18T07:21:10+00:00"
- },
{
"name": "theseer/tokenizer",
"version": "1.2.1",
diff --git a/src/Utopia/Messaging/Adapter.php b/src/Utopia/Messaging/Adapter.php
index 83422709..38ae9496 100644
--- a/src/Utopia/Messaging/Adapter.php
+++ b/src/Utopia/Messaging/Adapter.php
@@ -35,7 +35,7 @@ abstract public function getMaxMessagesPerRequest(): int;
/**
* Send a message.
*
- * @param Message $message The message to send.
+ * @param Message $message The message to send.
* @return string The response body.
*/
abstract public function send(Message $message): string;
@@ -43,11 +43,12 @@ abstract public function send(Message $message): string;
/**
* Send an HTTP request.
*
- * @param string $method The HTTP method to use.
- * @param string $url The URL to send the request to.
- * @param array $headers An array of headers to send with the request.
- * @param string|null $body The body of the request.
+ * @param string $method The HTTP method to use.
+ * @param string $url The URL to send the request to.
+ * @param array $headers An array of headers to send with the request.
+ * @param string|null $body The body of the request.
* @return string The response body.
+ *
* @throws \Exception If the request fails.
*/
protected function request(
@@ -56,7 +57,7 @@ protected function request(
array $headers = [],
mixed $body = null,
): string {
- $headers[] = 'Content-length: ' . \strlen($body);
+ $headers[] = 'Content-length: '.\strlen($body);
$ch = \curl_init();
@@ -66,14 +67,14 @@ protected function request(
\curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
\curl_setopt($ch, CURLOPT_USERAGENT, "Appwrite {$this->getName()} Message Sender");
- if (!is_null($body)) {
+ if (! is_null($body)) {
\curl_setopt($ch, CURLOPT_POSTFIELDS, $body);
}
$response = \curl_exec($ch);
if (\curl_errno($ch)) {
- throw new \Exception('Error:' . \curl_error($ch));
+ throw new \Exception('Error:'.\curl_error($ch));
}
if (\curl_getinfo($ch, CURLINFO_HTTP_CODE) >= 400) {
throw new \Exception($response);
diff --git a/src/Utopia/Messaging/Adapters/Email.php b/src/Utopia/Messaging/Adapters/Email.php
index 4cfff3fc..55318e46 100644
--- a/src/Utopia/Messaging/Adapters/Email.php
+++ b/src/Utopia/Messaging/Adapters/Email.php
@@ -19,24 +19,26 @@ public function getMessageType(): string
}
/**
- * @inheritdoc
+ * {@inheritdoc}
+ *
* @throws \Exception
*/
public function send(Message $message): string
{
- if (!\is_a($message, $this->getMessageType())) {
+ if (! \is_a($message, $this->getMessageType())) {
throw new \Exception('Invalid message type.');
}
if (\count($message->getTo()) > $this->getMaxMessagesPerRequest()) {
throw new \Exception("{$this->getName()} can only send {$this->getMaxMessagesPerRequest()} messages per request.");
}
+
return $this->process($message);
}
/**
* Process an email message.
*
- * @param EmailMessage $message Message to process.
+ * @param EmailMessage $message Message to process.
* @return string The response body.
*/
abstract protected function process(EmailMessage $message): string;
diff --git a/src/Utopia/Messaging/Adapters/Email/Mailgun.php b/src/Utopia/Messaging/Adapters/Email/Mailgun.php
index 1e022f04..872d6b09 100644
--- a/src/Utopia/Messaging/Adapters/Email/Mailgun.php
+++ b/src/Utopia/Messaging/Adapters/Email/Mailgun.php
@@ -2,14 +2,14 @@
namespace Utopia\Messaging\Adapters\Email;
-use Utopia\Messaging\Messages\Email;
use Utopia\Messaging\Adapters\Email as EmailAdapter;
+use Utopia\Messaging\Messages\Email;
class Mailgun extends EmailAdapter
{
/**
- * @param string $apiKey Your Mailgun API key to authenticate with the API.
- * @param string $domain Your Mailgun domain to send messages from.
+ * @param string $apiKey Your Mailgun API key to authenticate with the API.
+ * @param string $domain Your Mailgun domain to send messages from.
*/
public function __construct(
private string $apiKey,
@@ -28,7 +28,8 @@ public function getMaxMessagesPerRequest(): int
}
/**
- * @inheritdoc
+ * {@inheritdoc}
+ *
* @throws \Exception
*/
protected function process(Email $message): string
@@ -37,7 +38,7 @@ protected function process(Email $message): string
method: 'POST',
url: "https://api.mailgun.net/v3/{$this->domain}/messages",
headers: [
- 'Authorization: Basic ' . base64_encode('api:' . $this->apiKey)
+ 'Authorization: Basic '.base64_encode('api:'.$this->apiKey),
],
body: [
'from' => $message->getFrom(),
diff --git a/src/Utopia/Messaging/Adapters/Email/Mock.php b/src/Utopia/Messaging/Adapters/Email/Mock.php
index c13a43fa..0f326106 100644
--- a/src/Utopia/Messaging/Adapters/Email/Mock.php
+++ b/src/Utopia/Messaging/Adapters/Email/Mock.php
@@ -4,8 +4,8 @@
use PHPMailer\PHPMailer\Exception;
use PHPMailer\PHPMailer\PHPMailer;
-use Utopia\Messaging\Messages\Email;
use Utopia\Messaging\Adapters\Email as EmailAdapter;
+use Utopia\Messaging\Messages\Email;
class Mock extends EmailAdapter
{
@@ -21,7 +21,8 @@ public function getMaxMessagesPerRequest(): int
}
/**
- * @inheritdoc
+ * {@inheritdoc}
+ *
* @throws Exception
* @throws \Exception
*/
@@ -49,7 +50,7 @@ protected function process(Email $message): string
$mail->addAddress($to);
}
- if (!$mail->send()) {
+ if (! $mail->send()) {
throw new \Exception($mail->ErrorInfo);
}
diff --git a/src/Utopia/Messaging/Adapters/Email/Sendgrid.php b/src/Utopia/Messaging/Adapters/Email/Sendgrid.php
index dc0ec8e3..17745c48 100644
--- a/src/Utopia/Messaging/Adapters/Email/Sendgrid.php
+++ b/src/Utopia/Messaging/Adapters/Email/Sendgrid.php
@@ -2,8 +2,8 @@
namespace Utopia\Messaging\Adapters\Email;
-use Utopia\Messaging\Messages\Email;
use Utopia\Messaging\Adapters\Email as EmailAdapter;
+use Utopia\Messaging\Messages\Email;
class Sendgrid extends EmailAdapter
{
@@ -28,14 +28,14 @@ protected function process(Email $message): string
method: 'POST',
url: 'https://api.sendgrid.com/v3/mail/send',
headers: [
- 'Authorization: Bearer ' . $this->apiKey,
+ 'Authorization: Bearer '.$this->apiKey,
'Content-Type: application/json',
],
body: \json_encode([
'personalizations' => [
[
'to' => \array_map(
- fn($to) => ['email' => $to],
+ fn ($to) => ['email' => $to],
$message->getTo()
),
'subject' => $message->getSubject(),
diff --git a/src/Utopia/Messaging/Adapters/Push.php b/src/Utopia/Messaging/Adapters/Push.php
index 419fc987..6d96d9c4 100644
--- a/src/Utopia/Messaging/Adapters/Push.php
+++ b/src/Utopia/Messaging/Adapters/Push.php
@@ -19,24 +19,26 @@ public function getMessageType(): string
}
/**
- * @inheritdoc
+ * {@inheritdoc}
+ *
* @throws \Exception
*/
public function send(Message $message): string
{
- if (!\is_a($message, $this->getMessageType())) {
+ if (! \is_a($message, $this->getMessageType())) {
throw new \Exception('Invalid message type.');
}
if (\count($message->getTo()) > $this->getMaxMessagesPerRequest()) {
throw new \Exception("{$this->getName()} can only send {$this->getMaxMessagesPerRequest()} messages per request.");
}
+
return $this->process($message);
}
/**
* Send a push message.
*
- * @param PushMessage $message Message to process.
+ * @param PushMessage $message Message to process.
* @return string The response body.
*/
abstract protected function process(PushMessage $message): string;
diff --git a/src/Utopia/Messaging/Adapters/Push/FCM.php b/src/Utopia/Messaging/Adapters/Push/FCM.php
index 4205dc8f..3734b16d 100644
--- a/src/Utopia/Messaging/Adapters/Push/FCM.php
+++ b/src/Utopia/Messaging/Adapters/Push/FCM.php
@@ -2,13 +2,13 @@
namespace Utopia\Messaging\Adapters\Push;
-use Utopia\Messaging\Messages\Push;
use Utopia\Messaging\Adapters\Push as PushAdapter;
+use Utopia\Messaging\Messages\Push;
class FCM extends PushAdapter
{
/**
- * @param string $serverKey The FCM server key.
+ * @param string $serverKey The FCM server key.
*/
public function __construct(
private string $serverKey,
@@ -26,7 +26,8 @@ public function getMaxMessagesPerRequest(): int
}
/**
- * @inheritdoc
+ * {@inheritdoc}
+ *
* @throws \Exception
*/
protected function process(Push $message): string
@@ -35,7 +36,7 @@ protected function process(Push $message): string
method: 'POST',
url: 'https://fcm.googleapis.com/fcm/send',
headers: [
- "Content-Type: application/json",
+ 'Content-Type: application/json',
"Authorization: key={$this->serverKey}",
],
body: \json_encode([
diff --git a/src/Utopia/Messaging/Adapters/SMS.php b/src/Utopia/Messaging/Adapters/SMS.php
index 7b28dff8..5a2b6c4e 100644
--- a/src/Utopia/Messaging/Adapters/SMS.php
+++ b/src/Utopia/Messaging/Adapters/SMS.php
@@ -19,24 +19,26 @@ public function getMessageType(): string
}
/**
- * @inheritdoc
+ * {@inheritdoc}
+ *
* @throws \Exception
*/
public function send(Message $message): string
{
- if (!\is_a($message, $this->getMessageType())) {
+ if (! \is_a($message, $this->getMessageType())) {
throw new \Exception('Invalid message type.');
}
if (\count($message->getTo()) > $this->getMaxMessagesPerRequest()) {
throw new \Exception("{$this->getName()} can only send {$this->getMaxMessagesPerRequest()} messages per request.");
}
+
return $this->process($message);
}
/**
* Send an SMS message.
*
- * @param SMSMessage $message Message to send.
+ * @param SMSMessage $message Message to send.
* @return string The response body.
*/
abstract protected function process(SMSMessage $message): string;
diff --git a/src/Utopia/Messaging/Adapters/SMS/Mock.php b/src/Utopia/Messaging/Adapters/SMS/Mock.php
index 8a29890b..a9cd0eb8 100644
--- a/src/Utopia/Messaging/Adapters/SMS/Mock.php
+++ b/src/Utopia/Messaging/Adapters/SMS/Mock.php
@@ -2,14 +2,14 @@
namespace Utopia\Messaging\Adapters\SMS;
-use Utopia\Messaging\Messages\SMS;
use Utopia\Messaging\Adapters\SMS as SMSAdapter;
+use Utopia\Messaging\Messages\SMS;
class Mock extends SMSAdapter
{
/**
- * @param string $user User ID
- * @param string $secret User secret
+ * @param string $user User ID
+ * @param string $secret User secret
*/
public function __construct(
private string $user,
@@ -28,7 +28,8 @@ public function getMaxMessagesPerRequest(): int
}
/**
- * @inheritdoc
+ * {@inheritdoc}
+ *
* @throws \Exception
*/
protected function process(SMS $message): string
@@ -37,7 +38,7 @@ protected function process(SMS $message): string
method: 'POST',
url: 'http://request-catcher:5000/mock-sms',
headers: [
- "content-type: application/json",
+ 'content-type: application/json',
"x-username: {$this->user}",
"x-key: {$this->secret}",
],
diff --git a/src/Utopia/Messaging/Adapters/SMS/Msg91.php b/src/Utopia/Messaging/Adapters/SMS/Msg91.php
index a83e143d..82b2527d 100644
--- a/src/Utopia/Messaging/Adapters/SMS/Msg91.php
+++ b/src/Utopia/Messaging/Adapters/SMS/Msg91.php
@@ -2,8 +2,8 @@
namespace Utopia\Messaging\Adapters\SMS;
-use Utopia\Messaging\Messages\SMS;
use Utopia\Messaging\Adapters\SMS as SMSAdapter;
+use Utopia\Messaging\Messages\SMS;
// Reference Material
// https://docs.msg91.com/p/tf9GTextN/e/7WESqQ4RLu/MSG91
@@ -11,8 +11,8 @@
class Msg91 extends SMSAdapter
{
/**
- * @param string $senderId Msg91 Sender ID
- * @param string $authKey Msg91 Auth Key
+ * @param string $senderId Msg91 Sender ID
+ * @param string $authKey Msg91 Auth Key
*/
public function __construct(
private string $senderId,
@@ -32,13 +32,14 @@ public function getMaxMessagesPerRequest(): int
}
/**
- * @inheritdoc
+ * {@inheritdoc}
+ *
* @throws \Exception
*/
protected function process(SMS $message): string
{
$to = \array_map(
- fn($to) => ['mobiles' => \ltrim($to, '+')],
+ fn ($to) => ['mobiles' => \ltrim($to, '+')],
$message->getTo()
);
@@ -46,14 +47,14 @@ protected function process(SMS $message): string
method: 'POST',
url: 'https://api.msg91.com/api/v5/flow/',
headers: [
- "content-type: application/json",
+ 'content-type: application/json',
"authkey: {$this->authKey}",
],
body: \json_encode([
'sender' => $this->senderId,
'otp' => $message->getContent(),
'flow_id' => $message->getFrom(),
- 'recipients' => [$to]
+ 'recipients' => [$to],
]),
);
}
diff --git a/src/Utopia/Messaging/Adapters/SMS/Telesign.php b/src/Utopia/Messaging/Adapters/SMS/Telesign.php
index 7cef0f45..96b60042 100644
--- a/src/Utopia/Messaging/Adapters/SMS/Telesign.php
+++ b/src/Utopia/Messaging/Adapters/SMS/Telesign.php
@@ -2,8 +2,8 @@
namespace Utopia\Messaging\Adapters\SMS;
-use Utopia\Messaging\Messages\SMS;
use Utopia\Messaging\Adapters\SMS as SMSAdapter;
+use Utopia\Messaging\Messages\SMS;
// Reference Material
// https://developer.telesign.com/enterprise/reference/sendbulksms
@@ -11,8 +11,8 @@
class Telesign extends SMSAdapter
{
/**
- * @param string $username Telesign account username
- * @param string $password Telesign account password
+ * @param string $username Telesign account username
+ * @param string $password Telesign account password
*/
public function __construct(
private string $username,
@@ -31,13 +31,14 @@ public function getMaxMessagesPerRequest(): int
}
/**
- * @inheritdoc
+ * {@inheritdoc}
+ *
* @throws \Exception
*/
protected function process(SMS $message): string
{
$to = \array_map(
- fn($to) => \ltrim($to, '+'),
+ fn ($to) => \ltrim($to, '+'),
$message->getTo()
);
@@ -45,11 +46,11 @@ protected function process(SMS $message): string
method: 'POST',
url: 'https://rest-ww.telesign.com/v1/verify/bulk_sms',
headers: [
- 'Authorization: Basic ' . base64_encode("{$this->username}:{$this->password}")
+ 'Authorization: Basic '.base64_encode("{$this->username}:{$this->password}"),
],
body: [
'template' => $message->getContent(),
- 'recipients' => \implode(',', $to)
+ 'recipients' => \implode(',', $to),
],
);
}
diff --git a/src/Utopia/Messaging/Adapters/SMS/TextMagic.php b/src/Utopia/Messaging/Adapters/SMS/TextMagic.php
index a78a97dc..e941f3a5 100644
--- a/src/Utopia/Messaging/Adapters/SMS/TextMagic.php
+++ b/src/Utopia/Messaging/Adapters/SMS/TextMagic.php
@@ -5,14 +5,14 @@
// Reference Material
// https://www.textmagic.com/docs/api/send-sms/#How-to-send-bulk-text-messages
-use Utopia\Messaging\Messages\SMS;
use Utopia\Messaging\Adapters\SMS as SMSAdapter;
+use Utopia\Messaging\Messages\SMS;
class TextMagic extends SMSAdapter
{
/**
- * @param string $username TextMagic account username
- * @param string $apiKey TextMagic account API key
+ * @param string $username TextMagic account username
+ * @param string $apiKey TextMagic account API key
*/
public function __construct(
private string $username,
@@ -31,13 +31,14 @@ public function getMaxMessagesPerRequest(): int
}
/**
- * @inheritdoc
+ * {@inheritdoc}
+ *
* @throws \Exception
*/
protected function process(SMS $message): string
{
$to = \array_map(
- fn($to) => \ltrim($to, '+'),
+ fn ($to) => \ltrim($to, '+'),
$message->getTo()
);
diff --git a/src/Utopia/Messaging/Adapters/SMS/Twilio.php b/src/Utopia/Messaging/Adapters/SMS/Twilio.php
index 9a65225a..9f28ff2c 100644
--- a/src/Utopia/Messaging/Adapters/SMS/Twilio.php
+++ b/src/Utopia/Messaging/Adapters/SMS/Twilio.php
@@ -2,14 +2,14 @@
namespace Utopia\Messaging\Adapters\SMS;
-use Utopia\Messaging\Messages\SMS;
use Utopia\Messaging\Adapters\SMS as SMSAdapter;
+use Utopia\Messaging\Messages\SMS;
class Twilio extends SMSAdapter
{
/**
- * @param string $accountSid Twilio Account SID
- * @param string $authToken Twilio Auth Token
+ * @param string $accountSid Twilio Account SID
+ * @param string $authToken Twilio Auth Token
*/
public function __construct(
private string $accountSid,
@@ -28,7 +28,8 @@ public function getMaxMessagesPerRequest(): int
}
/**
- * @inheritdoc
+ * {@inheritdoc}
+ *
* @throws \Exception
*/
protected function process(SMS $message): string
@@ -37,12 +38,12 @@ protected function process(SMS $message): string
method: 'POST',
url: "https://api.twilio.com/2010-04-01/Accounts/{$this->accountSid}/Messages.json",
headers: [
- 'Authorization: Basic ' . base64_encode("{$this->accountSid}:{$this->authToken}")
+ 'Authorization: Basic '.base64_encode("{$this->accountSid}:{$this->authToken}"),
],
body: \http_build_query([
'Body' => $message->getContent(),
'From' => $message->getFrom(),
- 'To' => $message->getTo()[0]
+ 'To' => $message->getTo()[0],
]),
);
}
diff --git a/src/Utopia/Messaging/Adapters/SMS/TwilioNotify.php b/src/Utopia/Messaging/Adapters/SMS/TwilioNotify.php
index 64e07d8c..a977ed79 100644
--- a/src/Utopia/Messaging/Adapters/SMS/TwilioNotify.php
+++ b/src/Utopia/Messaging/Adapters/SMS/TwilioNotify.php
@@ -2,14 +2,14 @@
namespace Utopia\Messaging\Adapters\SMS;
-use Utopia\Messaging\Messages\SMS;
use Utopia\Messaging\Adapters\SMS as SMSAdapter;
+use Utopia\Messaging\Messages\SMS;
class TwilioNotify extends SMSAdapter
{
/**
- * @param string $accountSid Twilio Account SID
- * @param string $authToken Twilio Auth Token
+ * @param string $accountSid Twilio Account SID
+ * @param string $authToken Twilio Auth Token
*/
public function __construct(
private string $accountSid,
@@ -29,7 +29,8 @@ public function getMaxMessagesPerRequest(): int
}
/**
- * @inheritdoc
+ * {@inheritdoc}
+ *
* @throws \Exception
*/
protected function process(SMS $message): string
@@ -38,12 +39,12 @@ protected function process(SMS $message): string
method: 'POST',
url: "https://notify.twilio.com/v1/Services/{$this->serviceSid}/Notifications",
headers: [
- 'Authorization: Basic ' . base64_encode("{$this->accountSid}:{$this->authToken}")
+ 'Authorization: Basic '.base64_encode("{$this->accountSid}:{$this->authToken}"),
],
body: \http_build_query([
'Body' => $message->getContent(),
'ToBinding' => \json_encode(\array_map(
- fn($to) => ['binding_type' => 'sms', 'address' => $to],
+ fn ($to) => ['binding_type' => 'sms', 'address' => $to],
$message->getTo()
)),
]),
diff --git a/src/Utopia/Messaging/Adapters/SMS/Vonage.php b/src/Utopia/Messaging/Adapters/SMS/Vonage.php
index 598029ea..2c945374 100644
--- a/src/Utopia/Messaging/Adapters/SMS/Vonage.php
+++ b/src/Utopia/Messaging/Adapters/SMS/Vonage.php
@@ -5,14 +5,14 @@
// Reference Material
// https://www.textmagic.com/docs/api/send-sms/#How-to-send-bulk-text-messages
-use Utopia\Messaging\Messages\SMS;
use Utopia\Messaging\Adapters\SMS as SMSAdapter;
+use Utopia\Messaging\Messages\SMS;
class Vonage extends SMSAdapter
{
/**
- * @param string $apiKey Vonage API Key
- * @param string $apiSecret Vonage API Secret
+ * @param string $apiKey Vonage API Key
+ * @param string $apiSecret Vonage API Secret
*/
public function __construct(
private string $apiKey,
@@ -31,13 +31,14 @@ public function getMaxMessagesPerRequest(): int
}
/**
- * @inheritdoc
+ * {@inheritdoc}
+ *
* @throws \Exception
*/
protected function process(SMS $message): string
{
$to = \array_map(
- fn($to) => \ltrim($to, '+'),
+ fn ($to) => \ltrim($to, '+'),
$message->getTo()
);
@@ -49,7 +50,7 @@ protected function process(SMS $message): string
'from' => $message->getFrom(),
'to' => \implode(',', $to),
'api_key' => $this->apiKey,
- 'api_secret' => $this->apiSecret
+ 'api_secret' => $this->apiSecret,
]
);
}
diff --git a/src/Utopia/Messaging/Messages/Email.php b/src/Utopia/Messaging/Messages/Email.php
index e13ab30a..21fedeea 100644
--- a/src/Utopia/Messaging/Messages/Email.php
+++ b/src/Utopia/Messaging/Messages/Email.php
@@ -7,12 +7,12 @@
class Email implements Message
{
/**
- * @param array $to The recipients of the email.
- * @param string $subject The subject of the email.
- * @param string $content The content of the email.
- * @param string|null $from The sender of the email.
- * @param array|null $attachments The attachments of the email.
- * @param bool $html Whether the message is HTML or not.
+ * @param array $to The recipients of the email.
+ * @param string $subject The subject of the email.
+ * @param string $content The content of the email.
+ * @param string|null $from The sender of the email.
+ * @param array|null $attachments The attachments of the email.
+ * @param bool $html Whether the message is HTML or not.
*/
public function __construct(
private array $to,
diff --git a/src/Utopia/Messaging/Messages/Push.php b/src/Utopia/Messaging/Messages/Push.php
index 4a86a05e..d4a4333b 100644
--- a/src/Utopia/Messaging/Messages/Push.php
+++ b/src/Utopia/Messaging/Messages/Push.php
@@ -7,16 +7,16 @@
class Push implements Message
{
/**
- * @param array $to The recipients of the push notification.
- * @param string $title The title of the push notification.
- * @param string $body The body of the push notification.
- * @param array|null $data This parameter specifies the custom key-value pairs of the message's payload. For example, with data:{"score":"3x1"}:
On Apple platforms, if the message is sent via APNs, it represents the custom data fields. If it is sent via FCM, it would be represented as key value dictionary in AppDelegate application:didReceiveRemoteNotification:.
On Android, this would result in an intent extra named score with the string value 3x1.
The key should not be a reserved word ("from", "message_type", or any word starting with "google" or "gcm"). Do not use any of the words defined in this table (such as collapse_key).
Values in string types are recommended. You have to convert values in objects or other non-string data types (e.g., integers or booleans) to string.
- * @param string|null $sound The sound to play when the device receives the notification.
On Android, sound files must reside in /res/raw/.
On iOS, sounds files must reside in the main bundle of the client app or in the Library/Sounds folder of the app's data container.
- * @param string|null $action The action associated with a user click on the notification.
On Android, this is the activity to launch.
On iOS, this is the category to launch.
- * @param string|null $icon Android only. The icon of the push notification. Sets the notification icon to myicon for drawable resource myicon. If you don't send this key in the request, FCM displays the launcher icon specified in your app manifest.
- * @param string|null $color Android only. The icon color of the push notification, expressed in #rrggbb format.
- * @param string|null $tag Android only. Identifier used to replace existing notifications in the notification drawer.
If not specified, each request creates a new notification.
If specified and a notification with the same tag is already being shown, the new notification replaces the existing one in the notification drawer.
- * @param string|null $badge iOS only. The value of the badge on the home screen app icon. If not specified, the badge is not changed. If set to 0, the badge is removed.
+ * @param array $to The recipients of the push notification.
+ * @param string $title The title of the push notification.
+ * @param string $body The body of the push notification.
+ * @param array|null $data This parameter specifies the custom key-value pairs of the message's payload. For example, with data:{"score":"3x1"}:
On Apple platforms, if the message is sent via APNs, it represents the custom data fields. If it is sent via FCM, it would be represented as key value dictionary in AppDelegate application:didReceiveRemoteNotification:.
On Android, this would result in an intent extra named score with the string value 3x1.
The key should not be a reserved word ("from", "message_type", or any word starting with "google" or "gcm"). Do not use any of the words defined in this table (such as collapse_key).
Values in string types are recommended. You have to convert values in objects or other non-string data types (e.g., integers or booleans) to string.
+ * @param string|null $sound The sound to play when the device receives the notification.
On Android, sound files must reside in /res/raw/.
On iOS, sounds files must reside in the main bundle of the client app or in the Library/Sounds folder of the app's data container.
+ * @param string|null $action The action associated with a user click on the notification.
On Android, this is the activity to launch.
On iOS, this is the category to launch.
+ * @param string|null $icon Android only. The icon of the push notification. Sets the notification icon to myicon for drawable resource myicon. If you don't send this key in the request, FCM displays the launcher icon specified in your app manifest.
+ * @param string|null $color Android only. The icon color of the push notification, expressed in #rrggbb format.
+ * @param string|null $tag Android only. Identifier used to replace existing notifications in the notification drawer.
If not specified, each request creates a new notification.
If specified and a notification with the same tag is already being shown, the new notification replaces the existing one in the notification drawer.
+ * @param string|null $badge iOS only. The value of the badge on the home screen app icon. If not specified, the badge is not changed. If set to 0, the badge is removed.
*/
public function __construct(
private array $to,