@@ -17,8 +17,8 @@ |
||
| 17 | 17 | use ZendService\Apple\Apns\Client\AbstractClient; |
| 18 | 18 | use ZendService\Apple\Apns\Client\Feedback as FeedbackClient; |
| 19 | 19 | use ZendService\Apple\Apns\Client\Message as PushClient; |
| 20 | -use ZendService\Apple\Apns\Message\Alert as ServiceMessageAlert; |
|
| 21 | 20 | use ZendService\Apple\Apns\Message as ServiceMessage; |
| 21 | +use ZendService\Apple\Apns\Message\Alert as ServiceMessageAlert; |
|
| 22 | 22 | |
| 23 | 23 | /** |
| 24 | 24 | * APNS default service factory. |
@@ -22,7 +22,7 @@ |
||
| 22 | 22 | */ |
| 23 | 23 | public function setToken($token) |
| 24 | 24 | { |
| 25 | - if (!ctype_xdigit($token) || strlen($token) !== 64) { |
|
| 25 | + if ( ! ctype_xdigit($token) || strlen($token) !== 64) { |
|
| 26 | 26 | throw new \InvalidArgumentException('APNS token must be a 64 hex string'); |
| 27 | 27 | } |
| 28 | 28 | |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | |
| 102 | 102 | $this->receivers = new ArrayCollection; |
| 103 | 103 | if ($receivers !== null) { |
| 104 | - if (!is_array($receivers)) { |
|
| 104 | + if ( ! is_array($receivers)) { |
|
| 105 | 105 | $receivers = [$receivers]; |
| 106 | 106 | } |
| 107 | 107 | |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | { |
| 119 | 119 | $parameter = $this->getMappedParameter($parameter); |
| 120 | 120 | |
| 121 | - if (!array_key_exists($parameter, $this->defaultParameters)) { |
|
| 121 | + if ( ! array_key_exists($parameter, $this->defaultParameters)) { |
|
| 122 | 122 | throw new \InvalidArgumentException(sprintf('"%s" is not a valid notification parameter', $parameter)); |
| 123 | 123 | } |
| 124 | 124 | |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | */ |
| 49 | 49 | public function getParameters() |
| 50 | 50 | { |
| 51 | - if (!$this->parameters instanceof ArrayCollection) { |
|
| 51 | + if ( ! $this->parameters instanceof ArrayCollection) { |
|
| 52 | 52 | return []; |
| 53 | 53 | } |
| 54 | 54 | |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | */ |
| 87 | 87 | public function hasParameter($parameter) |
| 88 | 88 | { |
| 89 | - if (!$this->parameters instanceof ArrayCollection) { |
|
| 89 | + if ( ! $this->parameters instanceof ArrayCollection) { |
|
| 90 | 90 | return false; |
| 91 | 91 | } |
| 92 | 92 | |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | */ |
| 104 | 104 | public function getParameter($parameter, $default = null) |
| 105 | 105 | { |
| 106 | - if (!$this->parameters instanceof ArrayCollection) { |
|
| 106 | + if ( ! $this->parameters instanceof ArrayCollection) { |
|
| 107 | 107 | return $default; |
| 108 | 108 | } |
| 109 | 109 | |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | foreach ($pushMessage->getRegistrationIds() as $token) { |
| 168 | 168 | $statusCode = self::RESPONSE_OK; |
| 169 | 169 | |
| 170 | - if (!array_key_exists($token, $pushResponses)) { |
|
| 170 | + if ( ! array_key_exists($token, $pushResponses)) { |
|
| 171 | 171 | $statusCode = self::RESPONSE_UNKNOWN_ERROR; |
| 172 | 172 | } elseif (array_key_exists('error', $pushResponses[$token])) { |
| 173 | 173 | $statusCode = $pushResponses[$token]['error']; |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | { |
| 228 | 228 | foreach (array_chunk($notification->getReceivers(), 100) as $receivers) { |
| 229 | 229 | $tokens = array_map( |
| 230 | - function ($receiver) { |
|
| 230 | + function($receiver) { |
|
| 231 | 231 | return $receiver instanceof GcmReceiver ? $receiver->getToken() : null; |
| 232 | 232 | }, |
| 233 | 233 | $receivers |
@@ -120,7 +120,7 @@ |
||
| 120 | 120 | parent::__construct($parameters, $sandbox); |
| 121 | 121 | |
| 122 | 122 | $certificatePath = $this->getParameter(static::PARAMETER_CERTIFICATE); |
| 123 | - if (!file_exists($certificatePath) || !is_readable($certificatePath)) { |
|
| 123 | + if ( ! file_exists($certificatePath) || ! is_readable($certificatePath)) { |
|
| 124 | 124 | throw new AdapterException( |
| 125 | 125 | sprintf('Certificate file "%s" does not exist or is not readable', $certificatePath) |
| 126 | 126 | ); |
@@ -161,7 +161,7 @@ |
||
| 161 | 161 | public function setStatus($status) |
| 162 | 162 | { |
| 163 | 163 | $self = new \ReflectionClass(static::class); |
| 164 | - if (!in_array($status, $self->getConstants())) { |
|
| 164 | + if ( ! in_array($status, $self->getConstants())) { |
|
| 165 | 165 | throw new \InvalidArgumentException(sprintf('"%s" is not a valid status', $status)); |
| 166 | 166 | } |
| 167 | 167 | |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | { |
| 45 | 45 | $this->adapters = new ArrayCollection; |
| 46 | 46 | if ($adapters !== null) { |
| 47 | - if (!is_array($adapters)) { |
|
| 47 | + if ( ! is_array($adapters)) { |
|
| 48 | 48 | $adapters = [$adapters]; |
| 49 | 49 | } |
| 50 | 50 | |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | |
| 54 | 54 | $this->notifications = new ArrayCollection; |
| 55 | 55 | if ($notifications !== null) { |
| 56 | - if (!is_array($notifications)) { |
|
| 56 | + if ( ! is_array($notifications)) { |
|
| 57 | 57 | $notifications = [$notifications]; |
| 58 | 58 | } |
| 59 | 59 | |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | /* @var PushAdapter[] $pushAdapters */ |
| 178 | 178 | $pushAdapters = array_filter( |
| 179 | 179 | $this->adapters->toArray(), |
| 180 | - function (Adapter $adapter) { |
|
| 180 | + function(Adapter $adapter) { |
|
| 181 | 181 | return $adapter instanceof PushAdapter; |
| 182 | 182 | } |
| 183 | 183 | ); |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | /* @var FeedbackAdapter[] $feedbackAdapters */ |
| 206 | 206 | $feedbackAdapters = array_filter( |
| 207 | 207 | $this->adapters->toArray(), |
| 208 | - function (Adapter $adapter) { |
|
| 208 | + function(Adapter $adapter) { |
|
| 209 | 209 | return $adapter instanceof FeedbackAdapter; |
| 210 | 210 | } |
| 211 | 211 | ); |
@@ -133,7 +133,7 @@ |
||
| 133 | 133 | $parameter = $this->getMappedParameter($parameter); |
| 134 | 134 | |
| 135 | 135 | $self = new \ReflectionClass(static::class); |
| 136 | - if (!in_array($parameter, $self->getConstants())) { |
|
| 136 | + if ( ! in_array($parameter, $self->getConstants())) { |
|
| 137 | 137 | throw new \InvalidArgumentException(sprintf('"%s" is not a valid message parameter', $parameter)); |
| 138 | 138 | } |
| 139 | 139 | |