{"action":"closed","issue":{"url":"https://api.github.com/repos/AVATOR/yii2-turbosms/issues/2","labels_url":"https://api.github.com/repos/AVATOR/yii2-turbosms/issues/2/labels{/name}","comments_url":"https://api.github.com/repos/AVATOR/yii2-turbosms/issues/2/comments","events_url":"https://api.github.com/repos/AVATOR/yii2-turbosms/issues/2/events","html_url":"https://github.com/AVATOR/yii2-turbosms/issues/2","id":121702839,"number":2,"title":"Debug mode and connect","user":{"login":"skoro","id":6389201,"avatar_url":"https://avatars.githubusercontent.com/u/6389201?v=3","gravatar_id":"","url":"https://api.github.com/users/skoro","html_url":"https://github.com/skoro","followers_url":"https://api.github.com/users/skoro/followers","following_url":"https://api.github.com/users/skoro/following{/other_user}","gists_url":"https://api.github.com/users/skoro/gists{/gist_id}","starred_url":"https://api.github.com/users/skoro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/skoro/subscriptions","organizations_url":"https://api.github.com/users/skoro/orgs","repos_url":"https://api.github.com/users/skoro/repos","events_url":"https://api.github.com/users/skoro/events{/privacy}","received_events_url":"https://api.github.com/users/skoro/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":{"login":"AVATOR","id":4663351,"avatar_url":"https://avatars.githubusercontent.com/u/4663351?v=3","gravatar_id":"","url":"https://api.github.com/users/AVATOR","html_url":"https://github.com/AVATOR","followers_url":"https://api.github.com/users/AVATOR/followers","following_url":"https://api.github.com/users/AVATOR/following{/other_user}","gists_url":"https://api.github.com/users/AVATOR/gists{/gist_id}","starred_url":"https://api.github.com/users/AVATOR/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AVATOR/subscriptions","organizations_url":"https://api.github.com/users/AVATOR/orgs","repos_url":"https://api.github.com/users/AVATOR/repos","events_url":"https://api.github.com/users/AVATOR/events{/privacy}","received_events_url":"https://api.github.com/users/AVATOR/received_events","type":"User","site_admin":false},"milestone":null,"comments":1,"created_at":"2015-12-11T12:51:55Z","updated_at":"2016-01-24T14:34:46Z","closed_at":"2016-01-24T14:34:46Z","body":"Hello. I use this extension in my project and I found that in method send() instead code\r\n\r\n        if (!$this->debug || !$this->client) {\r\n            $this->connect();\r\n        }\r\n\r\nshould be\r\n\r\n        if (!$this->debug && !$this->client) {\r\n            $this->connect();\r\n        }\r\n\r\nso if debug mode is enabled we totally skip connection to service. Also I notice these methods getBalance() and getMessageStatus() work only after send() method. I propose such variant:\r\n\r\n    public function getBalance()\r\n    {\r\n        if (!$this->debug && !$this->client) {\r\n            $this->connect();\r\n        }\r\n        return $this->debug ? 0 : intval($this->client->GetCreditBalance()->GetCreditBalanceResult);\r\n    }\r\n\r\n\r\nOr do checking for debug mode inside connect() method.\r\n"}}