Changeset View
Changeset View
Standalone View
Standalone View
src/infrastructure/sms/storage/PhabricatorSMS.php
| Show All 32 Lines | final class PhabricatorSMS | ||||
| protected $sendStatus; | protected $sendStatus; | ||||
| public static function initializeNewSMS($body) { | public static function initializeNewSMS($body) { | ||||
| // NOTE: these values will be updated to correct values when the | // NOTE: these values will be updated to correct values when the | ||||
| // SMS is sent for the first time. In particular, the ProviderShortName | // SMS is sent for the first time. In particular, the ProviderShortName | ||||
| // and ProviderSMSID are totally garbage data before a send it attempted. | // and ProviderSMSID are totally garbage data before a send it attempted. | ||||
| return id(new PhabricatorSMS()) | return id(new PhabricatorSMS()) | ||||
| ->setBody($body) | ->setBody($body) | ||||
| ->setSendStatus(PhabricatorSMS::STATUS_UNSENT) | ->setSendStatus(self::STATUS_UNSENT) | ||||
| ->setProviderShortName(PhabricatorSMS::SHORTNAME_PLACEHOLDER) | ->setProviderShortName(self::SHORTNAME_PLACEHOLDER) | ||||
| ->setProviderSMSID(Filesystem::readRandomCharacters(40)); | ->setProviderSMSID(Filesystem::readRandomCharacters(40)); | ||||
| } | } | ||||
| protected function getConfiguration() { | protected function getConfiguration() { | ||||
| return array( | return array( | ||||
| self::CONFIG_COLUMN_SCHEMA => array( | self::CONFIG_COLUMN_SCHEMA => array( | ||||
| 'providerShortName' => 'text16', | 'providerShortName' => 'text16', | ||||
| 'providerSMSID' => 'text40', | 'providerSMSID' => 'text40', | ||||
| Show All 14 Lines | final class PhabricatorSMS | ||||
| public function getTableName() { | public function getTableName() { | ||||
| // Slightly non-standard, but otherwise this class needs "MetaMTA" in its | // Slightly non-standard, but otherwise this class needs "MetaMTA" in its | ||||
| // name. :/ | // name. :/ | ||||
| return 'sms'; | return 'sms'; | ||||
| } | } | ||||
| public function hasBeenSentAtLeastOnce() { | public function hasBeenSentAtLeastOnce() { | ||||
| return ($this->getProviderShortName() != | return ($this->getProviderShortName() != | ||||
| PhabricatorSMS::SHORTNAME_PLACEHOLDER); | self::SHORTNAME_PLACEHOLDER); | ||||
| } | } | ||||
| } | } | ||||