| @@ -68,7 +68,7 @@ | ||
| 68 | 68 | /** | 
| 69 | 69 | * Send data to provider. | 
| 70 | 70 | * | 
| 71 | - * @param array $subscribers | |
| 71 | + * @param Subscriber[] $subscribers | |
| 72 | 72 | * @param \Closure $success | 
| 73 | 73 | * @param \Closure $fail | 
| 74 | 74 | */ | 
| @@ -43,7 +43,7 @@ discard block | ||
| 43 | 43 | */ | 
| 44 | 44 | public function setProject(Project $project) | 
| 45 | 45 |      { | 
| 46 | - $this->project = $project; | |
| 46 | + $this->project = $project; | |
| 47 | 47 | |
| 48 | 48 | return $this; | 
| 49 | 49 | } | 
| @@ -75,10 +75,10 @@ discard block | ||
| 75 | 75 | protected function flush(array $subscribers, \Closure $success = null, \Closure $fail = null) | 
| 76 | 76 |      { | 
| 77 | 77 |          if (is_null($success)) { | 
| 78 | -            $success = function ($response, $index) {}; | |
| 78 | +            $success = function($response, $index) {}; | |
| 79 | 79 | } | 
| 80 | 80 |          if (is_null($fail)) { | 
| 81 | -            $fail = function ($reason, $index) {}; | |
| 81 | +            $fail = function($reason, $index) {}; | |
| 82 | 82 | } | 
| 83 | 83 | |
| 84 | 84 | $pool = new Pool(static::$browser, $this->prepareRequests($subscribers), [ | 
| @@ -65,7 +65,7 @@ discard block | ||
| 65 | 65 | |
| 66 | 66 | $this->flush( | 
| 67 | 67 | $subscribers, | 
| 68 | -            function (Response $response, $index) use ($notification) { | |
| 68 | +            function(Response $response, $index) use ($notification) { | |
| 69 | 69 |                  try { | 
| 70 | 70 |                      if ($response->getStatusCode() != 201) { | 
| 71 | 71 | $response = json_decode($response->getBody()); | 
| @@ -82,7 +82,7 @@ discard block | ||
| 82 | 82 | Driver::emit(new NotificationFailed($notification)); | 
| 83 | 83 | } | 
| 84 | 84 | }, | 
| 85 | -            function ($reason, $index) use ($notification) { | |
| 85 | +            function($reason, $index) use ($notification) { | |
| 86 | 86 | Driver::emit(new NotificationFailed($notification)); | 
| 87 | 87 | } | 
| 88 | 88 | ); | 
| @@ -67,7 +67,7 @@ discard block | ||
| 67 | 67 | |
| 68 | 68 | $this->flush( | 
| 69 | 69 | $subscribers, | 
| 70 | -            function (Response $response, $index) use ($notification, $total) { | |
| 70 | +            function(Response $response, $index) use ($notification, $total) { | |
| 71 | 71 |                  try { | 
| 72 | 72 | $response = json_decode($response->getBody()); | 
| 73 | 73 | |
| @@ -86,7 +86,7 @@ discard block | ||
| 86 | 86 | Driver::emit(new NotificationFailed($notification, $this->calculateChunkSize($index, $total))); | 
| 87 | 87 | } | 
| 88 | 88 | }, | 
| 89 | -            function ($reason, $index) use ($notification, $total) { | |
| 89 | +            function($reason, $index) use ($notification, $total) { | |
| 90 | 90 | Driver::emit(new NotificationFailed($notification, $this->calculateChunkSize($index, $total))); | 
| 91 | 91 | } | 
| 92 | 92 | ); | 
| @@ -49,16 +49,16 @@ | ||
| 49 | 49 | */ | 
| 50 | 50 | public function provideListeners(ListenerAcceptorInterface $listener) | 
| 51 | 51 |      { | 
| 52 | -        $listener->addListener(NotificationSent::class, function ($e) { | |
| 52 | +        $listener->addListener(NotificationSent::class, function($e) { | |
| 53 | 53 | $this->sent($e); | 
| 54 | 54 | }); | 
| 55 | -        $listener->addListener(NotificationDelivered::class, function ($e) { | |
| 55 | +        $listener->addListener(NotificationDelivered::class, function($e) { | |
| 56 | 56 | $this->delivered($e); | 
| 57 | 57 | }); | 
| 58 | -        $listener->addListener(NotificationClicked::class, function ($e) { | |
| 58 | +        $listener->addListener(NotificationClicked::class, function($e) { | |
| 59 | 59 | $this->clicked($e); | 
| 60 | 60 | }); | 
| 61 | -        $listener->addListener(NotificationFailed::class, function ($e) { | |
| 61 | +        $listener->addListener(NotificationFailed::class, function($e) { | |
| 62 | 62 | $this->failed($e); | 
| 63 | 63 | }); | 
| 64 | 64 | |
| @@ -127,11 +127,11 @@ | ||
| 127 | 127 |          foreach ($this->subscribers as $subscriber) { | 
| 128 | 128 | $provider = $subscriber->getProvider(); | 
| 129 | 129 | |
| 130 | -            if (! $this->project->providerConnected($provider)) { | |
| 130 | +            if ( ! $this->project->providerConnected($provider)) { | |
| 131 | 131 | continue; | 
| 132 | 132 | } | 
| 133 | 133 | |
| 134 | -            if (! isset($partials[$provider])) { | |
| 134 | +            if ( ! isset($partials[$provider])) { | |
| 135 | 135 | $partials[$provider] = []; | 
| 136 | 136 | } | 
| 137 | 137 | |
| @@ -57,7 +57,7 @@ discard block | ||
| 57 | 57 | */ | 
| 58 | 58 | public function getProvider($name) | 
| 59 | 59 |      { | 
| 60 | -        if (! $this->providerConnected($name)) { | |
| 60 | +        if ( ! $this->providerConnected($name)) { | |
| 61 | 61 |              throw new \RuntimeException("Unsupported provider '{$name}'"); | 
| 62 | 62 | } | 
| 63 | 63 | |
| @@ -82,7 +82,7 @@ discard block | ||
| 82 | 82 |      { | 
| 83 | 83 | $providersFactory = new ProvidersFactory($this); | 
| 84 | 84 | |
| 85 | -        if (! empty($this->config['providers']) && is_array($this->config['providers'])) { | |
| 85 | +        if ( ! empty($this->config['providers']) && is_array($this->config['providers'])) { | |
| 86 | 86 |              foreach ($this->config['providers'] as $name => $options) { | 
| 87 | 87 | $this->providers[$name] = $providersFactory->make($name, $options)->setProject($this); | 
| 88 | 88 | } | 
| @@ -155,7 +155,7 @@ discard block | ||
| 155 | 155 | $password = $this->certificate->getPassword(); | 
| 156 | 156 | |
| 157 | 157 | $certs = []; | 
| 158 | -        if (! openssl_pkcs12_read($pkcs12, $certs, $password)) { | |
| 158 | +        if ( ! openssl_pkcs12_read($pkcs12, $certs, $password)) { | |
| 159 | 159 | throw new \RuntimeException(openssl_error_string()); | 
| 160 | 160 | } | 
| 161 | 161 | |
| @@ -171,7 +171,7 @@ discard block | ||
| 171 | 171 | // Convert the signature from PEM to DER | 
| 172 | 172 | $signature_pem = file_get_contents($signaturePath); | 
| 173 | 173 | $matches = []; | 
| 174 | -        if (! preg_match('~Content-Disposition:[^\n]+\s*?([A-Za-z0-9+=/\r\n]+)\s*?-----~', $signature_pem, $matches)) { | |
| 174 | +        if ( ! preg_match('~Content-Disposition:[^\n]+\s*?([A-Za-z0-9+=/\r\n]+)\s*?-----~', $signature_pem, $matches)) { | |
| 175 | 175 | throw new \RuntimeException(openssl_error_string()); | 
| 176 | 176 | } | 
| 177 | 177 | |
| @@ -70,7 +70,7 @@ | ||
| 70 | 70 | */ | 
| 71 | 71 | protected function getApnsResource() | 
| 72 | 72 |      { | 
| 73 | -        if (! is_resource($this->apnsResource)) { | |
| 73 | +        if ( ! is_resource($this->apnsResource)) { | |
| 74 | 74 | $this->apnsResource = $this->createStreamClient(); | 
| 75 | 75 | } | 
| 76 | 76 | |
| @@ -12,14 +12,14 @@ | ||
| 12 | 12 | */ | 
| 13 | 13 | public function ensureHttps($image) | 
| 14 | 14 |      { | 
| 15 | -        if (! $image) { | |
| 15 | +        if ( ! $image) { | |
| 16 | 16 | return; | 
| 17 | 17 | } | 
| 18 | 18 | |
| 19 | 19 | $parsed = parse_url($image); | 
| 20 | 20 | |
| 21 | 21 | if ($parsed['scheme'] == 'https' || | 
| 22 | - $parsed['scheme'] == 'ssl' || | |
| 22 | + $parsed['scheme'] == 'ssl' || | |
| 23 | 23 |              preg_match('/192\.168|localhost|images\.weserv\.nl/', $parsed['host'])) { | 
| 24 | 24 | return $image; | 
| 25 | 25 | } |