Skip to content

Commit

Permalink
Fix analysis
Browse files Browse the repository at this point in the history
  • Loading branch information
abnegate committed Jan 10, 2024
1 parent 9824c91 commit 57609f2
Show file tree
Hide file tree
Showing 23 changed files with 67 additions and 60 deletions.
12 changes: 6 additions & 6 deletions src/Utopia/Messaging/Adapter/Chat/Discord.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@

class Discord extends Adapter
{
private const NAME = 'Discord';
private const TYPE = 'chat';
private const MESSAGE_TYPE = DiscordMessage::class;
protected const NAME = 'Discord';
protected const TYPE = 'chat';
protected const MESSAGE_TYPE = DiscordMessage::class;

/**
* @param string $webhookId Your Discord webhook ID.
Expand All @@ -24,17 +24,17 @@ public function __construct(

public function getName(): string
{
return self::NAME;
return static::NAME;
}

public function getType(): string
{
return self::TYPE;
return static::TYPE;
}

public function getMessageType(): string
{
return self::MESSAGE_TYPE;
return static::MESSAGE_TYPE;
}

public function getMaxMessagesPerRequest(): int
Expand Down
8 changes: 4 additions & 4 deletions src/Utopia/Messaging/Adapter/Email.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@

abstract class Email extends Adapter
{
private const TYPE = 'email';
private const MESSAGE_TYPE = EmailMessage::class;
protected const TYPE = 'email';
protected const MESSAGE_TYPE = EmailMessage::class;

public function getType(): string
{
return self::TYPE;
return static::TYPE;
}

public function getMessageType(): string
{
return self::MESSAGE_TYPE;
return static::MESSAGE_TYPE;
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/Utopia/Messaging/Adapter/Email/Mailgun.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

class Mailgun extends EmailAdapter
{
private const NAME = 'Mailgun';
protected const NAME = 'Mailgun';

/**
* @param string $apiKey Your Mailgun API key to authenticate with the API.
Expand All @@ -26,7 +26,7 @@ public function __construct(
*/
public function getName(): string
{
return self::NAME;
return static::NAME;
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/Utopia/Messaging/Adapter/Email/Mock.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@

class Mock extends EmailAdapter
{
private const NAME = 'Mock';
protected const NAME = 'Mock';

public function getName(): string
{
return self::NAME;
return static::NAME;
}

public function getMaxMessagesPerRequest(): int
Expand Down
4 changes: 2 additions & 2 deletions src/Utopia/Messaging/Adapter/Email/Sendgrid.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

class Sendgrid extends EmailAdapter
{
private const NAME = 'Sendgrid';
protected const NAME = 'Sendgrid';

/**
* @param string $apiKey Your Sendgrid API key to authenticate with the API.
Expand All @@ -23,7 +23,7 @@ public function __construct(private string $apiKey)
*/
public function getName(): string
{
return self::NAME;
return static::NAME;
}

/**
Expand Down
12 changes: 6 additions & 6 deletions src/Utopia/Messaging/Adapter/Push.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,23 @@

abstract class Push extends Adapter
{
private const TYPE = 'push';
private const MESSAGE_TYPE = PushMessage::class;
private const EXPIRED_MESSAGE = 'Expired device token.';
protected const TYPE = 'push';
protected const MESSAGE_TYPE = PushMessage::class;
protected const EXPIRED_MESSAGE = 'Expired device token.';

public function getType(): string
{
return self::TYPE;
return static::TYPE;
}

public function getMessageType(): string
{
return self::MESSAGE_TYPE;
return static::MESSAGE_TYPE;
}

protected function getExpiredErrorMessage(): string
{
return self::EXPIRED_MESSAGE;
return static::EXPIRED_MESSAGE;
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/Utopia/Messaging/Adapter/Push/APNS.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

class APNS extends PushAdapter
{
private const NAME = 'APNS';
protected const NAME = 'APNS';

/**
* @return void
Expand All @@ -28,7 +28,7 @@ public function __construct(
*/
public function getName(): string
{
return self::NAME;
return static::NAME;
}

/**
Expand Down
10 changes: 5 additions & 5 deletions src/Utopia/Messaging/Adapter/Push/FCM.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@

class FCM extends PushAdapter
{
private const NAME = 'FCM';
private const DEFAULT_EXPIRY_SECONDS = 3600; // 1 hour
private const DEFAULT_SKEW_SECONDS = 60; // 1 minute
private const GOOGLE_TOKEN_URL = 'https://www.googleapis.com/oauth2/v4/token';
protected const NAME = 'FCM';
protected const DEFAULT_EXPIRY_SECONDS = 3600; // 1 hour
protected const DEFAULT_SKEW_SECONDS = 60; // 1 minute
protected const GOOGLE_TOKEN_URL = 'https://www.googleapis.com/oauth2/v4/token';

/**
* @param string $serviceAccountJSON Service account JSON file contents
Expand All @@ -27,7 +27,7 @@ public function __construct(
*/
public function getName(): string
{
return self::NAME;
return static::NAME;
}

/**
Expand Down
8 changes: 4 additions & 4 deletions src/Utopia/Messaging/Adapter/SMS.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@

abstract class SMS extends Adapter
{
private const TYPE = 'sms';
private const MESSAGE_TYPE = SMSMessage::class;
protected const TYPE = 'sms';
protected const MESSAGE_TYPE = SMSMessage::class;

public function getType(): string
{
return self::TYPE;
return static::TYPE;
}

public function getMessageType(): string
{
return self::MESSAGE_TYPE;
return static::MESSAGE_TYPE;
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/Utopia/Messaging/Adapter/SMS/Clickatell.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
// https://docs.clickatell.com/channels/sms-channels/sms-api-reference/#tag/SMS-API/operation/sendMessageREST_1
class Clickatell extends SMSAdapter
{
private const NAME = 'Clickatell';
protected const NAME = 'Clickatell';

/**
* @param string $apiKey Clickatell API Key
Expand All @@ -23,7 +23,7 @@ public function __construct(

public function getName(): string
{
return self::NAME;
return static::NAME;
}

public function getMaxMessagesPerRequest(): int
Expand Down
4 changes: 2 additions & 2 deletions src/Utopia/Messaging/Adapter/SMS/GEOSMS.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

class GEOSMS extends SMSAdapter
{
private const NAME = 'GEOSMS';
protected const NAME = 'GEOSMS';

protected SMSAdapter $defaultAdapter;

Expand All @@ -24,7 +24,7 @@ public function __construct(SMSAdapter $defaultAdapter)

public function getName(): string
{
return self::NAME;
return static::NAME;
}

public function getMaxMessagesPerRequest(): int
Expand Down
4 changes: 2 additions & 2 deletions src/Utopia/Messaging/Adapter/SMS/Infobip.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
// https://www.infobip.com/docs/api/channels/sms/sms-messaging/outbound-sms/send-sms-message
class Infobip extends SMSAdapter
{
private const NAME = 'Infobip';
protected const NAME = 'Infobip';

/**
* @param string $apiBaseUrl Infobip API Base Url
Expand All @@ -25,7 +25,7 @@ public function __construct(

public function getName(): string
{
return self::NAME;
return static::NAME;
}

public function getMaxMessagesPerRequest(): int
Expand Down
7 changes: 7 additions & 0 deletions src/Utopia/Messaging/Adapter/SMS/Mock.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

class Mock extends SMSAdapter
{
protected const NAME = 'Mock';

/**
* @param string $user User ID
* @param string $secret User secret
Expand All @@ -18,6 +20,11 @@ public function __construct(
) {
}

public function getName(): string
{
return static::NAME;
}

public function getMaxMessagesPerRequest(): int
{
return 1000;
Expand Down
4 changes: 2 additions & 2 deletions src/Utopia/Messaging/Adapter/SMS/Msg91.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

class Msg91 extends SMSAdapter
{
private const NAME = 'Msg91';
protected const NAME = 'Msg91';

/**
* @param string $senderId Msg91 Sender ID
Expand All @@ -27,7 +27,7 @@ public function __construct(

public function getName(): string
{
return self::NAME;
return static::NAME;
}

public function getMaxMessagesPerRequest(): int
Expand Down
4 changes: 2 additions & 2 deletions src/Utopia/Messaging/Adapter/SMS/Plivo.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
// https://www.plivo.com/docs/sms/api/message#send-a-message
class Plivo extends SMSAdapter
{
private const NAME = 'Plivo';
protected const NAME = 'Plivo';

/**
* @param string $authId Plivo Auth ID
Expand All @@ -25,7 +25,7 @@ public function __construct(

public function getName(): string
{
return self::NAME;
return static::NAME;
}

public function getMaxMessagesPerRequest(): int
Expand Down
4 changes: 2 additions & 2 deletions src/Utopia/Messaging/Adapter/SMS/Seven.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
// https://www.seven.io/en/docs/gateway/http-api/sms-dispatch/
class Seven extends SMSAdapter
{
private const NAME = 'Seven';
protected const NAME = 'Seven';

/**
* @param string $apiKey Seven API token
Expand All @@ -23,7 +23,7 @@ public function __construct(

public function getName(): string
{
return self::NAME;
return static::NAME;
}

public function getMaxMessagesPerRequest(): int
Expand Down
4 changes: 2 additions & 2 deletions src/Utopia/Messaging/Adapter/SMS/Sinch.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
// https://developers.sinch.com/docs/sms/api-reference/
class Sinch extends SMSAdapter
{
private const NAME = 'Sinch';
protected const NAME = 'Sinch';

/**
* @param string $servicePlanId Sinch Service plan ID
Expand All @@ -25,7 +25,7 @@ public function __construct(

public function getName(): string
{
return self::NAME;
return static::NAME;
}

public function getMaxMessagesPerRequest(): int
Expand Down
4 changes: 2 additions & 2 deletions src/Utopia/Messaging/Adapter/SMS/Telesign.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

class Telesign extends SMSAdapter
{
private const NAME = 'Telesign';
protected const NAME = 'Telesign';

/**
* @param string $username Telesign account username
Expand All @@ -25,7 +25,7 @@ public function __construct(

public function getName(): string
{
return self::NAME;
return static::NAME;
}

public function getMaxMessagesPerRequest(): int
Expand Down
4 changes: 2 additions & 2 deletions src/Utopia/Messaging/Adapter/SMS/Telnyx.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

class Telnyx extends SMSAdapter
{
private const NAME = 'Telnyx';
protected const NAME = 'Telnyx';

/**
* @param string $apiKey Telnyx APIv2 Key
Expand All @@ -21,7 +21,7 @@ public function __construct(

public function getName(): string
{
return self::NAME;
return static::NAME;
}

public function getMaxMessagesPerRequest(): int
Expand Down
Loading

0 comments on commit 57609f2

Please sign in to comment.