-
Notifications
You must be signed in to change notification settings - Fork 181
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move isGsm7 to static for other libraries (#359)
- Loading branch information
Showing
2 changed files
with
6 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,9 +30,9 @@ public function __construct(string $to, string $from, protected string $message, | |
$this->setType($type); | ||
} | ||
|
||
public function isGsm7(): bool | ||
public static function isGsm7(string $message): bool | ||
{ | ||
return (bool)preg_match(self::GSM_7_PATTERN, $this->getMessage()); | ||
return (bool)preg_match(self::GSM_7_PATTERN, $message); | ||
} | ||
|
||
public function getContentId(): string | ||
|
@@ -59,14 +59,14 @@ public function setEntityId(string $id): self | |
|
||
public function getErrorMessage(): ?string | ||
{ | ||
if ($this->getType() === 'unicode' && $this->isGsm7()) { | ||
if ($this->getType() === 'unicode' && self::isGsm7($this->getMessage())) { | ||
$this->setErrorMessage("You are sending a message as `unicode` when it could be `text` or a | ||
`text` type with unicode-only characters. This could result in increased billing - | ||
See https://developer.vonage.com/messaging/sms for details, or email [email protected] if you have any | ||
questions."); | ||
} | ||
|
||
if ($this->getType() === 'text' && ! $this->isGsm7()) { | ||
if ($this->getType() === 'text' && ! self::isGsm7($this->getMessage())) { | ||
$this->setErrorMessage("You are sending a message as `text` when contains unicode only | ||
characters. This could result in encoding problems with the target device or increased billing - See | ||
https://developer.vonage.com/messaging/sms for details, or email [email protected] if you have any | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters