@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | |
| 66 | 66 | $this->flush( |
| 67 | 67 | $subscribers, |
| 68 | - function (Response $response) use ($notification) { |
|
| 68 | + function(Response $response) 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 () use ($notification) { |
|
| 85 | + function() use ($notification) { |
|
| 86 | 86 | Driver::emit(new NotificationFailed($notification)); |
| 87 | 87 | } |
| 88 | 88 | ); |
@@ -31,7 +31,8 @@ discard block |
||
| 31 | 31 | */ |
| 32 | 32 | protected static function initBrowser(array $config) |
| 33 | 33 | { |
| 34 | - if (static::$browser) { |
|
| 34 | + if (static::$browser) |
|
| 35 | + { |
|
| 35 | 36 | return; |
| 36 | 37 | } |
| 37 | 38 | |
@@ -65,12 +66,16 @@ discard block |
||
| 65 | 66 | |
| 66 | 67 | $this->flush( |
| 67 | 68 | $subscribers, |
| 68 | - function (Response $response) use ($notification) { |
|
| 69 | - try { |
|
| 70 | - if ($response->getStatusCode() != 201) { |
|
| 69 | + function (Response $response) use ($notification) |
|
| 70 | + { |
|
| 71 | + try |
|
| 72 | + { |
|
| 73 | + if ($response->getStatusCode() != 201) |
|
| 74 | + { |
|
| 71 | 75 | $response = json_decode($response->getBody()); |
| 72 | 76 | |
| 73 | - if (json_last_error() !== JSON_ERROR_NONE) { |
|
| 77 | + if (json_last_error() !== JSON_ERROR_NONE) |
|
| 78 | + { |
|
| 74 | 79 | throw new \Exception('Firefox: bad json'); |
| 75 | 80 | } |
| 76 | 81 | |
@@ -78,11 +83,14 @@ discard block |
||
| 78 | 83 | } |
| 79 | 84 | |
| 80 | 85 | Driver::emit(new NotificationSent($notification)); |
| 81 | - } catch (\Exception $e) { |
|
| 86 | + } |
|
| 87 | + catch (\Exception $e) |
|
| 88 | + { |
|
| 82 | 89 | Driver::emit(new NotificationFailed($notification)); |
| 83 | 90 | } |
| 84 | 91 | }, |
| 85 | - function () use ($notification) { |
|
| 92 | + function () use ($notification) |
|
| 93 | + { |
|
| 86 | 94 | Driver::emit(new NotificationFailed($notification)); |
| 87 | 95 | } |
| 88 | 96 | ); |
@@ -100,7 +108,8 @@ discard block |
||
| 100 | 108 | $headers = static::$headers; |
| 101 | 109 | $content = ''; |
| 102 | 110 | |
| 103 | - foreach ($subscribers as $subscriber) { |
|
| 111 | + foreach ($subscribers as $subscriber) |
|
| 112 | + { |
|
| 104 | 113 | $headers['Content-Length'] = strlen($content); |
| 105 | 114 | |
| 106 | 115 | yield new Request('POST', $this->getUrl($subscriber), $headers, $content); |