Skip to content

Commit f121426

Browse files
author
Oleksii
committed
fix
1 parent 62567e8 commit f121426

File tree

1 file changed

+29
-2
lines changed

1 file changed

+29
-2
lines changed

Turbosms.php

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,39 @@
1717
class Turbosms extends Component
1818
{
1919

20+
/**
21+
* @var string
22+
*/
2023
public $login;
2124

25+
/**
26+
* @var string
27+
*/
2228
public $password;
2329

30+
/**
31+
* @var string
32+
*/
2433
public $sender;
2534

35+
/**
36+
* @var bool
37+
*/
2638
public $debug = true;
2739

2840
protected $client;
2941

42+
/**
43+
* @var string
44+
*/
45+
protected $wsdl = 'http://turbosms.in.ua/api/wsdl.html';
46+
47+
/**
48+
* @param $text
49+
* @param $phones
50+
*
51+
* @throws InvalidConfigException
52+
*/
3053
public function send($text, $phones) {
3154

3255
if (!$this->debug || !$this->client) {
@@ -58,13 +81,17 @@ public function send($text, $phones) {
5881
}
5982
}
6083

84+
/**
85+
* @return SoapClient
86+
* @throws InvalidConfigException
87+
*/
6188
protected function connect() {
6289

6390
if ($this->client) {
6491
return $this->client;
6592
}
6693

67-
$client = new SoapClient('http://turbosms.in.ua/api/wsdl.html');
94+
$client = new SoapClient($this->wsdl);
6895

6996
if (!$this->login || !$this->password) {
7097
throw new InvalidConfigException('Enter login and password from Turbosms');
@@ -76,7 +103,7 @@ protected function connect() {
76103
]);
77104

78105
if ($result->AuthResult . '' != 'Вы успешно авторизировались') {
79-
return false;
106+
throw new InvalidConfigException($result->AuthResult);
80107
}
81108

82109
$this->client = $client;

0 commit comments

Comments
 (0)