Skip to content

Commit a837afe

Browse files
authored
Merge pull request #2 from lutskanu/master
Basic type hintings, access modifiers and some phpcs warnings purification
2 parents 54dfcbb + f901c95 commit a837afe

File tree

6 files changed

+12
-7
lines changed

6 files changed

+12
-7
lines changed

src/Client.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,13 @@ class Client implements ClientInterface
1010
{
1111
const DEFAULT_API_URL = 'https://fcm.googleapis.com/fcm/send';
1212

13+
/** @var string */
1314
private $apiKey;
15+
16+
/** @var string */
1417
private $proxyApiUrl;
18+
19+
/** @var GuzzleHttp\ClientInterface */
1520
private $guzzleClient;
1621

1722
public function injectHttpClient(GuzzleHttp\ClientInterface $client)

src/ClientInterface.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ interface ClientInterface
1515
*
1616
* @return \paragraph1\phpFCM\Client
1717
*/
18-
function setApiKey($apiKey);
18+
public function setApiKey($apiKey);
1919

2020

2121
/**
@@ -25,7 +25,7 @@ function setApiKey($apiKey);
2525
*
2626
* @return \paragraph1\phpFCM\Client
2727
*/
28-
function setProxyApiUrl($url);
28+
public function setProxyApiUrl($url);
2929

3030
/**
3131
* sends your notification to the google servers and returns a guzzle repsonse object
@@ -36,6 +36,6 @@ function setProxyApiUrl($url);
3636
* @return \Psr\Http\Message\ResponseInterface
3737
* @throws \GuzzleHttp\Exception\RequestException
3838
*/
39-
function send(Message $message);
39+
public function send(Message $message);
4040

4141
}

src/Message.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ class Message implements \JsonSerializable
3030
* where should the message go
3131
*
3232
* @param Recipient $recipient
33+
* @throws \UnexpectedValueException
34+
* @throws \InvalidArgumentException
3335
*
3436
* @return \paragraph1\phpFCM\Message
3537
*/
@@ -133,7 +135,7 @@ function (Topic $topic) { return sprintf("'%s' in topics", $topic->getIdentifier
133135
$jsonData['to'] = sprintf('/topics/%s', current($this->recipients)->getIdentifier());
134136
break;
135137
default:
136-
if (count($this->recipients) == 1) {
138+
if (count($this->recipients) === 1) {
137139
$jsonData['to'] = current($this->recipients)->getIdentifier();
138140
}
139141
}

src/Recipient/Device.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ class Device implements Recipient
88
public function __construct($token)
99
{
1010
$this->token = $token;
11-
return $this;
1211
}
1312

1413
public function getIdentifier()

src/Recipient/Recipient.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33

44
interface Recipient
55
{
6-
function getIdentifier();
6+
public function getIdentifier();
77
}

src/Recipient/Topic.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ class Topic implements Recipient
88
public function __construct($name)
99
{
1010
$this->name = $name;
11-
return $this;
1211
}
1312

1413
public function getIdentifier()

0 commit comments

Comments
 (0)