@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | 'hash' => 'Your Hash', |
| 29 | 29 | 'sender' => 'Sender Name', |
| 30 | 30 | ], |
| 31 | - 'twilio' => [ // Install: composer require twilio/sdk |
|
| 31 | + 'twilio' => [// Install: composer require twilio/sdk |
|
| 32 | 32 | 'sid' => 'Your SID', |
| 33 | 33 | 'token' => 'Your Token', |
| 34 | 34 | 'from' => 'Your Default From Number', |
@@ -39,13 +39,13 @@ discard block |
||
| 39 | 39 | 'password' => 'Your Password', |
| 40 | 40 | 'sender' => 'Sender name', |
| 41 | 41 | ], |
| 42 | - 'melipayamak' => [ // Install: composer require melipayamak/php |
|
| 42 | + 'melipayamak' => [// Install: composer require melipayamak/php |
|
| 43 | 43 | 'username' => 'Your Username', |
| 44 | 44 | 'password' => 'Your Password', |
| 45 | 45 | 'from' => 'Your Default From Number', |
| 46 | 46 | 'flash' => false, |
| 47 | 47 | ], |
| 48 | - 'kavenegar' => [ // Install: composer require kavenegar/php |
|
| 48 | + 'kavenegar' => [// Install: composer require kavenegar/php |
|
| 49 | 49 | 'apiKey' => 'Your Api Key', |
| 50 | 50 | 'from' => 'Your Default From Number', |
| 51 | 51 | ], |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | public function to($numbers) |
| 38 | 38 | { |
| 39 | 39 | $recipients = is_array($numbers) ? $numbers : [$numbers]; |
| 40 | - $recipients = array_map(function ($item) { |
|
| 40 | + $recipients = array_map(function($item) { |
|
| 41 | 41 | return trim($item); |
| 42 | 42 | }, array_merge($this->recipients, $recipients)); |
| 43 | 43 | |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | */ |
| 60 | 60 | public function message($message) |
| 61 | 61 | { |
| 62 | - if (! is_string($message)) { |
|
| 62 | + if (!is_string($message)) { |
|
| 63 | 63 | throw new \Exception('Message text should be a string.'); |
| 64 | 64 | } |
| 65 | 65 | if (trim($message) == '') { |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | 'SecretKey' => $this->settings->secretKey, |
| 46 | 46 | ]; |
| 47 | 47 | $response = $this->client->post( |
| 48 | - $this->settings->url.'api/Token', |
|
| 48 | + $this->settings->url . 'api/Token', |
|
| 49 | 49 | [ |
| 50 | 50 | 'json' => $body, |
| 51 | 51 | 'connect_timeout' => 30 |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | 'Mobile' => $recipient, |
| 89 | 89 | ]; |
| 90 | 90 | $response = $this->client->post( |
| 91 | - $this->settings->url.'api/UltraFastSend', |
|
| 91 | + $this->settings->url . 'api/UltraFastSend', |
|
| 92 | 92 | [ |
| 93 | 93 | 'json' => $body, |
| 94 | 94 | 'headers' => [ |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | // Send message: |
| 129 | 129 | $response = $this->client->request( |
| 130 | 130 | 'POST', |
| 131 | - $this->settings->url.'api/MessageSend', |
|
| 131 | + $this->settings->url . 'api/MessageSend', |
|
| 132 | 132 | [ |
| 133 | 133 | 'json' => $body, |
| 134 | 134 | 'headers' => [ |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | protected function getResponseData($response) |
| 153 | 153 | { |
| 154 | 154 | if ($response->getStatusCode() != 200 && $response->getStatusCode() != 201) { |
| 155 | - return ['status' => false, 'message' => 'Request Error. '.$response->getReasonPhrase()]; |
|
| 155 | + return ['status' => false, 'message' => 'Request Error. ' . $response->getReasonPhrase()]; |
|
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | $data = json_decode((string) $response->getBody(), true); |
@@ -65,7 +65,7 @@ |
||
| 65 | 65 | protected function getResponseData($response) |
| 66 | 66 | { |
| 67 | 67 | if ($response->getStatusCode() != 200) { |
| 68 | - return ['status' => false, 'message' => 'Request Error. '.$response->getReasonPhrase()]; |
|
| 68 | + return ['status' => false, 'message' => 'Request Error. ' . $response->getReasonPhrase()]; |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | $data = json_decode((string) $response->getBody(), true); |
@@ -65,7 +65,7 @@ |
||
| 65 | 65 | protected function getResponseData($response) |
| 66 | 66 | { |
| 67 | 67 | if ($response->getStatusCode() != 200) { |
| 68 | - return ['status' => false, 'message' => 'Request Error. '.$response->getReasonPhrase()]; |
|
| 68 | + return ['status' => false, 'message' => 'Request Error. ' . $response->getReasonPhrase()]; |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | $data = json_decode((string) $response->getBody(), true); |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | |
| 17 | 17 | $this->assertArraySubset(config('sms'), $manager->getConfig()); |
| 18 | 18 | $this->assertEquals(config('sms.default'), $manager->getDriver()); |
| 19 | - $this->assertArraySubset($manager->getSettings(), config('sms.drivers.'.$manager->getDriver())); |
|
| 19 | + $this->assertArraySubset($manager->getSettings(), config('sms.drivers.' . $manager->getDriver())); |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | public function test_it_wont_accespt_wrong_driver() |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | $manager = (new MockSmsManager())->via($gateway); |
| 32 | 32 | |
| 33 | 33 | $this->assertEquals($gateway, $manager->getDriver()); |
| 34 | - $this->assertArraySubset($manager->getSettings(), config('sms.drivers.'.$gateway)); |
|
| 34 | + $this->assertArraySubset($manager->getSettings(), config('sms.drivers.' . $gateway)); |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | public function test_it_has_proper_driver_instance() |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | public function test_can_call_directly() |
| 45 | 45 | { |
| 46 | 46 | $response = (new MockSmsManager())->via('bar') |
| 47 | - ->send('foo', function ($message) { |
|
| 47 | + ->send('foo', function($message) { |
|
| 48 | 48 | $message->to(['baz']); |
| 49 | 49 | }); |
| 50 | 50 | $this->assertInstanceOf(BarDriver::class, $response); |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | |
| 55 | 55 | public function test_can_call_from_facade() |
| 56 | 56 | { |
| 57 | - $response = Sms::via('bar')->send('foo', function ($m) { |
|
| 57 | + $response = Sms::via('bar')->send('foo', function($m) { |
|
| 58 | 58 | $m->to('baz'); |
| 59 | 59 | }); |
| 60 | 60 | |
@@ -5,7 +5,6 @@ |
||
| 5 | 5 | use Tzsk\Sms\Facade\Sms; |
| 6 | 6 | use Tzsk\Sms\SmsBuilder; |
| 7 | 7 | use Tzsk\Sms\Abstracts\Driver; |
| 8 | -use Tzsk\Sms\Drivers\Textlocal; |
|
| 9 | 8 | use Tzsk\Sms\Tests\Mocks\MockSmsManager; |
| 10 | 9 | use Tzsk\Sms\Tests\Mocks\Drivers\BarDriver; |
| 11 | 10 | |
@@ -21,7 +21,7 @@ |
||
| 21 | 21 | |
| 22 | 22 | protected function getEnvironmentSetUp($app) |
| 23 | 23 | { |
| 24 | - $settings = require __DIR__.'/../src/Config/sms.php'; |
|
| 24 | + $settings = require __DIR__ . '/../src/Config/sms.php'; |
|
| 25 | 25 | $settings['drivers']['bar'] = ['key' => 'foo']; |
| 26 | 26 | $settings['map']['bar'] = BarDriver::class; |
| 27 | 27 | |
@@ -18,13 +18,13 @@ |
||
| 18 | 18 | * Configurations that needs to be done by user. |
| 19 | 19 | */ |
| 20 | 20 | $this->publishes([ |
| 21 | - __DIR__.'/../Config/sms.php' => config_path('sms.php'), |
|
| 21 | + __DIR__ . '/../Config/sms.php' => config_path('sms.php'), |
|
| 22 | 22 | ], 'config'); |
| 23 | 23 | |
| 24 | 24 | /** |
| 25 | 25 | * Bind to service container. |
| 26 | 26 | */ |
| 27 | - $this->app->bind('tzsk-sms', function () { |
|
| 27 | + $this->app->bind('tzsk-sms', function() { |
|
| 28 | 28 | return new SmsManager(config('sms')); |
| 29 | 29 | }); |
| 30 | 30 | } |
@@ -3,7 +3,6 @@ |
||
| 3 | 3 | namespace Tzsk\Sms\Channels; |
| 4 | 4 | |
| 5 | 5 | use Tzsk\Sms\SmsBuilder; |
| 6 | -use Tzsk\Sms\SmsManager; |
|
| 7 | 6 | use Illuminate\Notifications\Notification; |
| 8 | 7 | |
| 9 | 8 | class SmsChannel |
@@ -23,11 +23,11 @@ discard block |
||
| 23 | 23 | $this->validate($message); |
| 24 | 24 | $manager = app()->make('tzsk-sms'); |
| 25 | 25 | |
| 26 | - if (! empty($message->getDriver())) { |
|
| 26 | + if (!empty($message->getDriver())) { |
|
| 27 | 27 | $manager->via($message->getDriver()); |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | - return $manager->send($message->getBody(), function ($sms) use ($message) { |
|
| 30 | + return $manager->send($message->getBody(), function($sms) use ($message) { |
|
| 31 | 31 | $sms->to($message->getRecipients()); |
| 32 | 32 | }); |
| 33 | 33 | } |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | */ |
| 41 | 41 | private function validate($message) |
| 42 | 42 | { |
| 43 | - if (! is_a($message, SmsBuilder::class)) { |
|
| 43 | + if (!is_a($message, SmsBuilder::class)) { |
|
| 44 | 44 | throw new \Exception('Invalid data for sms notification.'); |
| 45 | 45 | } |
| 46 | 46 | |