| Conditions | 3 |
| Paths | 3 |
| Total Lines | 15 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 43 | public function send(string $message): bool |
||
| 44 | { |
||
| 45 | if (!getenv('FREE_SMS_URL')) { |
||
| 46 | throw new \Exception('Pas d\'URL free mobile configurée'); |
||
| 47 | } |
||
| 48 | $sender = getenv('BOT_NAME') ?? ''; |
||
| 49 | $message = sprintf('%s : %s', $sender, $message); |
||
| 50 | $url = getenv('FREE_SMS_URL').urlencode($message); |
||
| 51 | |||
| 52 | $response = $this->client->get($url, ['timeout' => 8]); |
||
| 53 | if (200 === $response->getStatusCode()) { |
||
| 54 | return true; |
||
| 55 | } |
||
| 56 | |||
| 57 | return false; |
||
| 58 | } |
||
| 60 |