1 | <?php |
||
15 | class ApnChannel |
||
16 | { |
||
17 | const SANDBOX = 0; |
||
18 | const PRODUCTION = 1; |
||
19 | |||
20 | /** @var string */ |
||
21 | protected $environment; |
||
22 | |||
23 | /** @var string */ |
||
24 | protected $certificate; |
||
25 | |||
26 | /** @var string|null */ |
||
27 | protected $passPhrase; |
||
28 | |||
29 | /** @var \ZendService\Apple\Apns\Client\Message */ |
||
30 | protected $client; |
||
31 | |||
32 | /** @var \Illuminate\Events\Dispatcher */ |
||
33 | protected $events; |
||
34 | |||
35 | /** |
||
36 | * @param \ZendService\Apple\Apns\Client\Message $client |
||
37 | * @param \Illuminate\Events\Dispatcher $events |
||
38 | * @param string $environment |
||
39 | * @param string $certificate |
||
40 | * @param string|null $passPhrase |
||
41 | */ |
||
42 | 1 | public function __construct(Client $client, Dispatcher $events, $environment, $certificate, $passPhrase = null) |
|
50 | |||
51 | /** |
||
52 | * Send the notification to Apple Push Notification Service. |
||
53 | * |
||
54 | * @param mixed $notifiable |
||
55 | * @param \Illuminate\Notifications\Notification $notification |
||
56 | * |
||
57 | * @throws \NotificationChannels\Apn\Exceptions\SendingFailed |
||
58 | */ |
||
59 | 1 | public function send($notifiable, Notification $notification) |
|
106 | |||
107 | /** |
||
108 | * Open the connection. |
||
109 | * |
||
110 | * @return bool |
||
111 | * |
||
112 | * @throws \NotificationChannels\Apn\Exceptions\ConnectionFailed |
||
113 | */ |
||
114 | 1 | private function openConnection() |
|
124 | |||
125 | /** |
||
126 | * Close the connection. |
||
127 | */ |
||
128 | 1 | private function closeConnection() |
|
132 | } |
||
133 |
This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.
Consider making the comparison explicit by using
empty(..)
or! empty(...)
instead.