Skip to content

Commit 057475f

Browse files
authored
Merge pull request #1 from Alymosul/analysis-8jojZr
Apply fixes from StyleCI
2 parents 843efc2 + 912047f commit 057475f

File tree

8 files changed

+32
-33
lines changed

8 files changed

+32
-33
lines changed

src/ExpoChannel.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
namespace NotificationChannels\ExpoPushNotifications;
44

5-
use ExponentPhpSDK\Exceptions\ExpoException;
65
use ExponentPhpSDK\Expo;
76
use Illuminate\Events\Dispatcher;
7+
use Illuminate\Notifications\Notification;
8+
use ExponentPhpSDK\Exceptions\ExpoException;
89
use Illuminate\Notifications\Events\NotificationFailed;
910
use NotificationChannels\ExpoPushNotifications\Exceptions\CouldNotSendNotification;
10-
use Illuminate\Notifications\Notification;
1111

1212
class ExpoChannel
1313
{
@@ -34,7 +34,7 @@ public function __construct(Expo $expo, Dispatcher $events)
3434
}
3535

3636
/**
37-
* Send the given notification
37+
* Send the given notification.
3838
*
3939
* @param mixed $notifiable
4040
* @param \Illuminate\Notifications\Notification $notification

src/ExpoMessage.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ public function badge(int $value)
106106
}
107107

108108
/**
109-
* Set the time to live of the notification
109+
* Set the time to live of the notification.
110110
*
111111
* @param int $ttl
112112
*
@@ -120,7 +120,7 @@ public function setTtl(int $ttl)
120120
}
121121

122122
/**
123-
* Get an array representation of the message
123+
* Get an array representation of the message.
124124
*
125125
* @return array
126126
*/

src/ExpoPushNotificationsServiceProvider.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
use ExponentPhpSDK\Expo;
66
use ExponentPhpSDK\ExpoRegistrar;
77
use ExponentPhpSDK\ExpoRepository;
8-
use ExponentPhpSDK\Repositories\ExpoFileDriver;
98
use Illuminate\Support\ServiceProvider;
9+
use ExponentPhpSDK\Repositories\ExpoFileDriver;
1010

1111
class ExpoPushNotificationsServiceProvider extends ServiceProvider
1212
{
@@ -22,7 +22,7 @@ public function boot()
2222
});
2323

2424
//Load routes
25-
$this->loadRoutesFrom(__DIR__ . '/Http/routes.php');
25+
$this->loadRoutesFrom(__DIR__.'/Http/routes.php');
2626
}
2727

2828
/**

src/Http/ExpoController.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
namespace NotificationChannels\ExpoPushNotifications\Http;
44

5-
use Illuminate\Http\JsonResponse;
65
use Illuminate\Http\Request;
6+
use Illuminate\Http\JsonResponse;
77
use Illuminate\Routing\Controller;
88
use Illuminate\Support\Facades\Auth;
99
use Illuminate\Support\Facades\Validator;
@@ -27,7 +27,7 @@ public function __construct(ExpoChannel $expoChannel)
2727
}
2828

2929
/**
30-
* Handles subscription endpoint for an expo token
30+
* Handles subscription endpoint for an expo token.
3131
*
3232
* @param Request $request
3333
*
@@ -36,15 +36,15 @@ public function __construct(ExpoChannel $expoChannel)
3636
public function subscribe(Request $request)
3737
{
3838
$validator = Validator::make($request->all(), [
39-
'expo_token' => 'required|string'
39+
'expo_token' => 'required|string',
4040
]);
4141

4242
if ($validator->fails()) {
4343
return JsonResponse::create([
4444
'status' => 'failed',
4545
'error' => [
46-
'message' => 'Expo Token is required'
47-
]
46+
'message' => 'Expo Token is required',
47+
],
4848
], 422);
4949
}
5050

@@ -58,19 +58,19 @@ public function subscribe(Request $request)
5858
return JsonResponse::create([
5959
'status' => 'failed',
6060
'error' => [
61-
'message' => $e->getMessage()
62-
]
61+
'message' => $e->getMessage(),
62+
],
6363
], 500);
6464
}
6565

6666
return JsonResponse::create([
6767
'status' => 'succeeded',
68-
'expo_token' => $token
68+
'expo_token' => $token,
6969
], 200);
7070
}
7171

7272
/**
73-
* Handles removing subscription endpoint for the authenticated interest
73+
* Handles removing subscription endpoint for the authenticated interest.
7474
*
7575
* @return \Illuminate\Http\JsonResponse
7676
*/
@@ -84,8 +84,8 @@ public function unsubscribe()
8484
return JsonResponse::create([
8585
'status' => 'failed',
8686
'error' => [
87-
'message' => $e->getMessage()
88-
]
87+
'message' => $e->getMessage(),
88+
],
8989
], 500);
9090
}
9191

src/Http/routes.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
Route::group(['prefix' => 'api/exponent/devices', 'middleware' => 'auth:api, bindings'], function () {
44
Route::post('subscribe', [
55
'as' => 'register-interest',
6-
'uses' => 'NotificationChannels\ExpoPushNotifications\Http\ExpoController@subscribe'
6+
'uses' => 'NotificationChannels\ExpoPushNotifications\Http\ExpoController@subscribe',
77
]);
88

99
Route::post('unsubscribe', [
1010
'as' => 'remove-interest',
11-
'uses' => 'NotificationChannels\ExpoPushNotifications\Http\ExpoController@unsubscribe'
11+
'uses' => 'NotificationChannels\ExpoPushNotifications\Http\ExpoController@unsubscribe',
1212
]);
1313
});

tests/ChannelTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@
22

33
namespace NotificationChannels\ExpoPushNotifications\Test;
44

5-
use ExponentPhpSDK\Exceptions\ExpoException;
5+
use Mockery;
66
use ExponentPhpSDK\Expo;
7+
use PHPUnit\Framework\TestCase;
78
use Illuminate\Events\Dispatcher;
8-
use Illuminate\Notifications\Events\NotificationFailed;
99
use Illuminate\Notifications\Notifiable;
1010
use Illuminate\Notifications\Notification;
11-
use Mockery;
11+
use ExponentPhpSDK\Exceptions\ExpoException;
12+
use Illuminate\Notifications\Events\NotificationFailed;
1213
use NotificationChannels\ExpoPushNotifications\ExpoChannel;
1314
use NotificationChannels\ExpoPushNotifications\ExpoMessage;
14-
use PHPUnit\Framework\TestCase;
1515

1616
class ChannelTest extends TestCase
1717
{
@@ -108,4 +108,4 @@ public function toExpoPush($notifiable)
108108
{
109109
return new ExpoMessage();
110110
}
111-
}
111+
}

tests/ExpoControllerTest.php

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,14 @@
33
namespace NotificationChannels\ExpoPushNotifications\Test;
44

55
use ExponentPhpSDK\Expo;
6-
use ExponentPhpSDK\ExpoRegistrar;
7-
use ExponentPhpSDK\Repositories\ExpoFileDriver;
8-
use Illuminate\Events\Dispatcher;
96
use Illuminate\Http\Request;
7+
use PHPUnit\Framework\TestCase;
8+
use Illuminate\Events\Dispatcher;
9+
use Illuminate\Validation\Factory;
1010
use Illuminate\Support\Facades\Auth;
1111
use Illuminate\Support\Facades\Validator;
12-
use Illuminate\Validation\Factory;
1312
use NotificationChannels\ExpoPushNotifications\ExpoChannel;
1413
use NotificationChannels\ExpoPushNotifications\Http\ExpoController;
15-
use PHPUnit\Framework\TestCase;
1614

1715
class ExpoControllerTest extends TestCase
1816
{
@@ -134,7 +132,7 @@ public function unsubscribeReturnsErrorResponseIfExceptionIsThrown()
134132
}
135133

136134
/**
137-
* Mocks a request for the ExpoController
135+
* Mocks a request for the ExpoController.
138136
*
139137
* @param $data
140138
*
@@ -163,6 +161,7 @@ private function mockValidator(bool $fails)
163161
$validator->shouldReceive('fails')->once()->andReturn($fails);
164162

165163
Validator::swap($validation);
164+
166165
return $validator;
167166
}
168167
}
@@ -173,4 +172,4 @@ public function getKey()
173172
{
174173
return 1;
175174
}
176-
}
175+
}

tests/MessageTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
namespace NotificationChannels\ExpoPushNotifications\Test;
44

55
use Illuminate\Support\Arr;
6-
use NotificationChannels\ExpoPushNotifications\ExpoMessage;
76
use PHPUnit\Framework\TestCase;
7+
use NotificationChannels\ExpoPushNotifications\ExpoMessage;
88

99
class MessageTest extends TestCase
1010
{

0 commit comments

Comments
 (0)