Skip to content

Commit a23003e

Browse files
committed
Codestyle improvements
1 parent 8d20af7 commit a23003e

File tree

4 files changed

+33
-18
lines changed

4 files changed

+33
-18
lines changed

src/Exceptions/CouldNotSendNotification.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@
44

55
class CouldNotSendNotification extends \Exception
66
{
7+
/**
8+
* Create service exception.
9+
*
10+
* @param $response
11+
* @return static
12+
*/
713
public static function serviceRespondedWithAnError($response)
814
{
915
return new static('Descriptive error message.');

src/FirebaseChannel.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,16 @@
1111
class FirebaseChannel
1212
{
1313
/**
14-
* @var paragraph1\phpFCM\Client
14+
* FCM client.
15+
*
16+
* @var \paragraph1\phpFCM\Client
1517
*/
1618
protected $client;
1719

1820
/**
1921
* Push Service constructor.
2022
*
21-
* @param paragraph1\phpFCM\Client $client
23+
* @param \paragraph1\phpFCM\Client $client
2224
*/
2325
public function __construct(Client $client)
2426
{

src/FirebaseMessage.php

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,25 @@
66

77
class FirebaseMessage
88
{
9+
/**
10+
* Notification.
11+
*
12+
* @var \paragraph1\phpFCM\Notification
13+
*/
914
public $notification;
1015

16+
/**
17+
* Custom data.
18+
*
19+
* @var array
20+
*/
1121
public $data = [];
1222

1323
/**
14-
* @param string $body
24+
* Static constructor.
1525
*
26+
* @param string $title
27+
* @param string $body
1628
* @return static
1729
*/
1830
public static function create($title = '', $body = '')
@@ -21,6 +33,9 @@ public static function create($title = '', $body = '')
2133
}
2234

2335
/**
36+
* FirebaseMessage constructor.
37+
*
38+
* @param string $title
2439
* @param string $body
2540
*/
2641
public function __construct($title = '', $body = '')
@@ -35,7 +50,6 @@ public function __construct($title = '', $body = '')
3550
* Set the message body.
3651
*
3752
* @param string $value
38-
*
3953
* @return $this
4054
*/
4155
public function body($value)
@@ -49,7 +63,6 @@ public function body($value)
4963
* Set the message title.
5064
*
5165
* @param string $value
52-
*
5366
* @return $this
5467
*/
5568
public function title($value)
@@ -63,7 +76,6 @@ public function title($value)
6376
* Set notification sound.
6477
*
6578
* @param string $value
66-
*
6779
* @return $this
6880
*/
6981
public function sound($value = 'default')
@@ -77,7 +89,6 @@ public function sound($value = 'default')
7789
* Set badge number. IOS only.
7890
*
7991
* @param int $integer
80-
*
8192
* @return $this
8293
*/
8394
public function badge($integer)

src/FirebaseServiceProvider.php

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
namespace Alfa6661\Firebase;
44

55
use Exception;
6-
use paragraph1\phpFCM\Client;
6+
use GuzzleHttp\Client as GuzzleClient;
7+
use paragraph1\phpFCM\Client as FcmClient;
78
use Illuminate\Support\ServiceProvider;
89

910
class FirebaseServiceProvider extends ServiceProvider
@@ -14,24 +15,19 @@ class FirebaseServiceProvider extends ServiceProvider
1415
public function boot()
1516
{
1617
$this->app->when(FirebaseChannel::class)
17-
->needs(Client::class)
18+
->needs(FcmClient::class)
1819
->give(function () {
1920
$firebaseConfig = config('services.firebase');
21+
2022
if (is_null($firebaseConfig)) {
2123
throw new Exception('In order to send notification via firebase you need to add credentials in the `firebase` key of `config.services`.');
2224
}
23-
$client = new Client();
25+
26+
$client = new FcmClient();
2427
$client->setApiKey($firebaseConfig['api_key']);
25-
$client->injectHttpClient(new \GuzzleHttp\Client());
28+
$client->injectHttpClient(new GuzzleClient());
2629

2730
return $client;
2831
});
2932
}
30-
31-
/**
32-
* Register the application services.
33-
*/
34-
public function register()
35-
{
36-
}
3733
}

0 commit comments

Comments
 (0)