| @@ 91-102 (lines=12) @@ | ||
| 88 | * | |
| 89 | * @return string|null | |
| 90 | */ | |
| 91 | public function getSmsNumber() | |
| 92 |     { | |
| 93 | $this->init(); | |
| 94 |         if ($this->data->contact_info->phone) { | |
| 95 |             foreach ($this->data->contact_info->phone as $phone) { | |
| 96 |                 if ($phone->preferred_sms) { | |
| 97 | return $phone->phone_number; | |
| 98 | } | |
| 99 | } | |
| 100 | } | |
| 101 | return null; | |
| 102 | } | |
| 103 | ||
| 104 | /** | |
| 105 | * Remove the preferred SMS flag from any number. | |
| @@ 107-117 (lines=11) @@ | ||
| 104 | /** | |
| 105 | * Remove the preferred SMS flag from any number. | |
| 106 | */ | |
| 107 | public function unsetSmsNumber() | |
| 108 |     { | |
| 109 | $this->init(); | |
| 110 |         if ($this->data->contact_info->phone) { | |
| 111 |             foreach ($this->data->contact_info->phone as $phone) { | |
| 112 |                 if ($phone->preferred_sms) { | |
| 113 | $phone->preferred_sms = false; | |
| 114 | } | |
| 115 | } | |
| 116 | } | |
| 117 | } | |
| 118 | ||
| 119 | /** | |
| 120 | * Set the user's preferred SMS number, creating a new internal mobile number if needed | |