@@ -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) == '') { |
@@ -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 | } |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | | |
| 23 | 23 | */ |
| 24 | 24 | 'drivers' => [ |
| 25 | - 'sns' => [ // Install: composer require aws/aws-sdk-php |
|
| 25 | + 'sns' => [// Install: composer require aws/aws-sdk-php |
|
| 26 | 26 | 'key' => 'Your AWS SNS Access Key', |
| 27 | 27 | 'secret' => 'Your AWS SNS Secret Key', |
| 28 | 28 | 'region' => 'Your AWS SNS Region', |
@@ -35,17 +35,17 @@ discard block |
||
| 35 | 35 | 'hash' => 'Your Hash', |
| 36 | 36 | 'sender' => 'Sender Name', |
| 37 | 37 | ], |
| 38 | - 'nexmo' => [ // Install: composer require nexmo/client |
|
| 38 | + 'nexmo' => [// Install: composer require nexmo/client |
|
| 39 | 39 | 'key' => 'Your Nexmo API Key', |
| 40 | 40 | 'secret' => 'Your Nexmo API Secret', |
| 41 | 41 | 'from' => 'Your Nexmo From Number', |
| 42 | 42 | ], |
| 43 | - 'twilio' => [ // Install: composer require twilio/sdk |
|
| 43 | + 'twilio' => [// Install: composer require twilio/sdk |
|
| 44 | 44 | 'sid' => 'Your SID', |
| 45 | 45 | 'token' => 'Your Token', |
| 46 | 46 | 'from' => 'Your Default From Number', |
| 47 | 47 | ], |
| 48 | - 'clockwork' => [ // Install: composer require mediaburst/clockworksms |
|
| 48 | + 'clockwork' => [// Install: composer require mediaburst/clockworksms |
|
| 49 | 49 | 'key' => 'Your clockwork API Key', |
| 50 | 50 | ], |
| 51 | 51 | 'linkmobility' => [ |
@@ -54,13 +54,13 @@ discard block |
||
| 54 | 54 | 'password' => 'Your Password', |
| 55 | 55 | 'sender' => 'Sender name', |
| 56 | 56 | ], |
| 57 | - 'melipayamak' => [ // Install: composer require melipayamak/php |
|
| 57 | + 'melipayamak' => [// Install: composer require melipayamak/php |
|
| 58 | 58 | 'username' => 'Your Username', |
| 59 | 59 | 'password' => 'Your Password', |
| 60 | 60 | 'from' => 'Your Default From Number', |
| 61 | 61 | 'flash' => false, |
| 62 | 62 | ], |
| 63 | - 'kavenegar' => [ // Install: composer require kavenegar/php |
|
| 63 | + 'kavenegar' => [// Install: composer require kavenegar/php |
|
| 64 | 64 | 'apiKey' => 'Your Api Key', |
| 65 | 65 | 'from' => 'Your Default From Number', |
| 66 | 66 | ], |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | foreach ($this->recipients as $recipient) { |
| 48 | 48 | $result = $this->client->request( |
| 49 | 49 | 'POST', |
| 50 | - $this->settings->url.'api/MessageSend', |
|
| 50 | + $this->settings->url . 'api/MessageSend', |
|
| 51 | 51 | $this->payload($recipient, $token) |
| 52 | 52 | ); |
| 53 | 53 | $response->put($recipient, $result); |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | 'SecretKey' => $this->settings->secretKey, |
| 90 | 90 | ]; |
| 91 | 91 | $response = $this->client->post( |
| 92 | - $this->settings->url.'api/Token', |
|
| 92 | + $this->settings->url . 'api/Token', |
|
| 93 | 93 | ['json' => $body, 'connect_timeout' => 30] |
| 94 | 94 | ); |
| 95 | 95 | |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | |
| 17 | 17 | $this->assertSameSize(config('sms'), $manager->getConfig()); |
| 18 | 18 | $this->assertEquals(config('sms.default'), $manager->getDriver()); |
| 19 | - $this->assertSameSize($manager->getSettings(), config('sms.drivers.'.$manager->getDriver())); |
|
| 19 | + $this->assertSameSize($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->assertSameSize($manager->getSettings(), config('sms.drivers.'.$gateway)); |
|
| 34 | + $this->assertSameSize($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 | |
@@ -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 | } |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | private function validate($message) |
| 42 | 42 | { |
| 43 | 43 | $conditions = [ |
| 44 | - 'Invalid data for sms notification.' => ! is_a($message, SmsBuilder::class), |
|
| 44 | + 'Invalid data for sms notification.' => !is_a($message, SmsBuilder::class), |
|
| 45 | 45 | 'Message body could not be empty.' => empty($message->getBody()), |
| 46 | 46 | 'Message recipient could not be empty.' => empty($message->getRecipients()), |
| 47 | 47 | ]; |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | $this->builder->send($message); |
| 91 | - if (! $callback) { |
|
| 91 | + if (!$callback) { |
|
| 92 | 92 | return $this; |
| 93 | 93 | } |
| 94 | 94 | |
@@ -149,8 +149,8 @@ discard block |
||
| 149 | 149 | $conditions = [ |
| 150 | 150 | 'Driver not selected or default driver does not exist.' => empty($this->driver), |
| 151 | 151 | 'Driver not found in config file. Try updating the package.' => empty($this->config['drivers'][$this->driver]) || empty($this->config['map'][$this->driver]), |
| 152 | - 'Driver source not found. Please update the package.' => ! class_exists($this->config['map'][$this->driver]), |
|
| 153 | - 'Driver must be an instance of Contracts\DriverInterface.' => ! (new ReflectionClass($this->config['map'][$this->driver]))->implementsInterface(Contracts\DriverInterface::class), |
|
| 152 | + 'Driver source not found. Please update the package.' => !class_exists($this->config['map'][$this->driver]), |
|
| 153 | + 'Driver must be an instance of Contracts\DriverInterface.' => !(new ReflectionClass($this->config['map'][$this->driver]))->implementsInterface(Contracts\DriverInterface::class), |
|
| 154 | 154 | ]; |
| 155 | 155 | |
| 156 | 156 | foreach ($conditions as $ex => $condition) { |
@@ -60,7 +60,7 @@ |
||
| 60 | 60 | |
| 61 | 61 | /** |
| 62 | 62 | * @param string $recipient |
| 63 | - * @return array |
|
| 63 | + * @return SendMessageRequest |
|
| 64 | 64 | */ |
| 65 | 65 | protected function payload($recipient) |
| 66 | 66 | { |