@@ -32,7 +32,7 @@ |
||
32 | 32 | */ |
33 | 33 | protected function hosnameAndIp($hostname, $ipAdress) |
34 | 34 | { |
35 | - return $hostname . ($hostname != $ipAdress ? " ({$ipAdress})" : ''); |
|
35 | + return $hostname.($hostname != $ipAdress ? " ({$ipAdress})" : ''); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | /** |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | */ |
60 | 60 | protected function hosnameAndIp($hostname, $ipAdress) |
61 | 61 | { |
62 | - return $hostname . ($hostname != $ipAdress ? " ({$ipAdress})" : ''); |
|
62 | + return $hostname.($hostname != $ipAdress ? " ({$ipAdress})" : ''); |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | /** |
@@ -82,35 +82,35 @@ discard block |
||
82 | 82 | if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { |
83 | 83 | // -n = number of pings; -i = ttl; -w = timeout (in milliseconds). |
84 | 84 | $exec_string = |
85 | - $this->pingBin . |
|
86 | - ' -n 1 -i ' . |
|
87 | - $ttl . |
|
88 | - ' -w ' . |
|
89 | - ($timeout * 1000) . |
|
90 | - ' ' . |
|
85 | + $this->pingBin. |
|
86 | + ' -n 1 -i '. |
|
87 | + $ttl. |
|
88 | + ' -w '. |
|
89 | + ($timeout * 1000). |
|
90 | + ' '. |
|
91 | 91 | $host; |
92 | 92 | } elseif (strtoupper(PHP_OS) === 'DARWIN') { |
93 | 93 | // Exec string for Darwin based systems (OS X). |
94 | 94 | // -n = numeric output; -c = number of pings; -m = ttl; -t = timeout. |
95 | 95 | $exec_string = |
96 | - $this->pingBin . |
|
97 | - ' -n -c 1 -m ' . |
|
98 | - $ttl . |
|
99 | - ' -t ' . |
|
100 | - $timeout . |
|
101 | - ' ' . |
|
96 | + $this->pingBin. |
|
97 | + ' -n -c 1 -m '. |
|
98 | + $ttl. |
|
99 | + ' -t '. |
|
100 | + $timeout. |
|
101 | + ' '. |
|
102 | 102 | $host; |
103 | 103 | } else { |
104 | 104 | // Exec string for other UNIX-based systems (Linux). |
105 | 105 | // -n = numeric output; -c = number of pings; -t = ttl; -W = timeout |
106 | 106 | $exec_string = |
107 | - $this->pingBin . |
|
108 | - ' -n -c 1 -t ' . |
|
109 | - $ttl . |
|
110 | - ' -W ' . |
|
111 | - $timeout . |
|
112 | - ' ' . |
|
113 | - $host . |
|
107 | + $this->pingBin. |
|
108 | + ' -n -c 1 -t '. |
|
109 | + $ttl. |
|
110 | + ' -W '. |
|
111 | + $timeout. |
|
112 | + ' '. |
|
113 | + $host. |
|
114 | 114 | ' 2>&1'; |
115 | 115 | } |
116 | 116 |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | */ |
84 | 84 | public function getSilentChecker() |
85 | 85 | { |
86 | - return function () { |
|
86 | + return function() { |
|
87 | 87 | return $this->checkResources(); |
88 | 88 | }; |
89 | 89 | } |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | private function makeString($string, $checkSystem) |
99 | 99 | { |
100 | 100 | return ( |
101 | - $string . |
|
101 | + $string. |
|
102 | 102 | ($checkSystem |
103 | 103 | ? config('health.string.ok') |
104 | 104 | : config('health.string.fail')) |
@@ -133,10 +133,10 @@ discard block |
||
133 | 133 | */ |
134 | 134 | public function string() |
135 | 135 | { |
136 | - return collect($this->health())->reduce(function ($current, $resource) { |
|
136 | + return collect($this->health())->reduce(function($current, $resource) { |
|
137 | 137 | return ( |
138 | - $current . |
|
139 | - ($current ? config('health.string.glue') : '') . |
|
138 | + $current. |
|
139 | + ($current ? config('health.string.glue') : ''). |
|
140 | 140 | $this->makeString( |
141 | 141 | $resource->abbreviation, |
142 | 142 | $resource->isHealthy() |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | |
46 | 46 | return instantiate( |
47 | 47 | config( |
48 | - 'health.notifications.channels.' . strtolower($name) . '.sender' |
|
48 | + 'health.notifications.channels.'.strtolower($name).'.sender' |
|
49 | 49 | ) |
50 | 50 | ); |
51 | 51 | } |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | config('health.notifications.from.icon_emoji') |
106 | 106 | ) |
107 | 107 | ->content($this->getMessage()) |
108 | - ->attachment(function ($attachment) { |
|
108 | + ->attachment(function($attachment) { |
|
109 | 109 | $attachment |
110 | 110 | ->title($this->getActionTitle(), $this->getActionLink()) |
111 | 111 | ->content($this->result->errorMessage); |
@@ -29,7 +29,7 @@ |
||
29 | 29 | return false; |
30 | 30 | } |
31 | 31 | |
32 | - return collect($masters)->contains(function ($master) { |
|
32 | + return collect($masters)->contains(function($master) { |
|
33 | 33 | return $master->status === 'paused'; |
34 | 34 | }) |
35 | 35 | ? false |
@@ -145,12 +145,12 @@ discard block |
||
145 | 145 | $current = collect(); |
146 | 146 | |
147 | 147 | $targets = $targets |
148 | - ->map(function (Collection $targetList) { |
|
149 | - return $targetList->map(function ($target, $name) { |
|
148 | + ->map(function(Collection $targetList) { |
|
149 | + return $targetList->map(function($target, $name) { |
|
150 | 150 | return Target::factory($this, $target, $name); |
151 | 151 | }); |
152 | 152 | }) |
153 | - ->reduce(function ($current, $targetList) { |
|
153 | + ->reduce(function($current, $targetList) { |
|
154 | 154 | foreach ($targetList as $target) { |
155 | 155 | $current[] = $target; |
156 | 156 | } |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | */ |
181 | 181 | public function check($action = 'resource') |
182 | 182 | { |
183 | - $this->setCurrentAction($action)->targets->each(function ( |
|
183 | + $this->setCurrentAction($action)->targets->each(function( |
|
184 | 184 | Target $target |
185 | 185 | ) { |
186 | 186 | $target->check($target); |
@@ -209,14 +209,14 @@ discard block |
||
209 | 209 | */ |
210 | 210 | public function isHealthy() |
211 | 211 | { |
212 | - return $this->targets->reduce(function ($carry, $target) { |
|
212 | + return $this->targets->reduce(function($carry, $target) { |
|
213 | 213 | return $carry && $target->result->healthy; |
214 | 214 | }, true); |
215 | 215 | } |
216 | 216 | |
217 | 217 | protected function keysToCamel($array) |
218 | 218 | { |
219 | - return collect($array)->mapWithKeys(function ($item, $key) { |
|
219 | + return collect($array)->mapWithKeys(function($item, $key) { |
|
220 | 220 | return [camel_case($key) => $item]; |
221 | 221 | }); |
222 | 222 | } |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | */ |
239 | 239 | protected function sendNotifications() |
240 | 240 | { |
241 | - return collect(config('health.notifications.channels'))->each(function ( |
|
241 | + return collect(config('health.notifications.channels'))->each(function( |
|
242 | 242 | $channel |
243 | 243 | ) { |
244 | 244 | try { |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | return ( |
274 | 274 | $this->notify && |
275 | 275 | config('health.notifications.enabled') && |
276 | - config('health.notifications.notify_on.' . $this->currentAction) |
|
276 | + config('health.notifications.notify_on.'.$this->currentAction) |
|
277 | 277 | ); |
278 | 278 | } |
279 | 279 |
@@ -89,11 +89,11 @@ discard block |
||
89 | 89 | |
90 | 90 | $resources = $this->sortResources( |
91 | 91 | $this->getNonGlobalResources() |
92 | - ->each(function ($resource) { |
|
92 | + ->each(function($resource) { |
|
93 | 93 | $this->checkResource($resource); |
94 | 94 | }) |
95 | 95 | ->merge( |
96 | - $this->getGlobalResources()->each(function ($resource) { |
|
96 | + $this->getGlobalResources()->each(function($resource) { |
|
97 | 97 | return $resource->checkGlobal($this->getResources()); |
98 | 98 | }) |
99 | 99 | ) |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | ? $resource |
119 | 119 | : $this->getResourceBySlug($resource); |
120 | 120 | |
121 | - $checked = $this->cache->remember($resource->slug, function () use ( |
|
121 | + $checked = $this->cache->remember($resource->slug, function() use ( |
|
122 | 122 | $resource |
123 | 123 | ) { |
124 | 124 | return $resource->check($this->getCurrentAction()); |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | protected function allResourcesAreGood() |
169 | 169 | { |
170 | 170 | return !$this->getResources() |
171 | - ->reject(function ($resource) { |
|
171 | + ->reject(function($resource) { |
|
172 | 172 | return !$resource instanceof Resource; |
173 | 173 | }) |
174 | 174 | ->isEmpty(); |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | */ |
183 | 183 | protected function getNonGlobalResources() |
184 | 184 | { |
185 | - return $this->getResources()->filter(function (Resource $resource) { |
|
185 | + return $this->getResources()->filter(function(Resource $resource) { |
|
186 | 186 | return !$resource->isGlobal; |
187 | 187 | }); |
188 | 188 | } |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | */ |
196 | 196 | protected function getGlobalResources() |
197 | 197 | { |
198 | - return $this->getResources()->filter(function (Resource $resource) { |
|
198 | + return $this->getResources()->filter(function(Resource $resource) { |
|
199 | 199 | return $resource->isGlobal; |
200 | 200 | }); |
201 | 201 | } |
@@ -283,8 +283,8 @@ discard block |
||
283 | 283 | { |
284 | 284 | if (is_null($this->resources) || $this->resources->isEmpty()) { |
285 | 285 | $this->resources = $this->resourceLoader->loadResources()->map( |
286 | - function ($resource) { |
|
287 | - return $this->handleExceptions(function () use ($resource) { |
|
286 | + function($resource) { |
|
287 | + return $this->handleExceptions(function() use ($resource) { |
|
288 | 288 | return $this->makeResource($resource); |
289 | 289 | }); |
290 | 290 | } |
@@ -319,13 +319,13 @@ discard block |
||
319 | 319 | protected function sortResources($resources) |
320 | 320 | { |
321 | 321 | if ($sortBy = config('health.sort_by')) { |
322 | - return $resources->sortBy(function ($resource) use ($sortBy) { |
|
323 | - return $this->handleExceptions(function () use ( |
|
322 | + return $resources->sortBy(function($resource) use ($sortBy) { |
|
323 | + return $this->handleExceptions(function() use ( |
|
324 | 324 | $resource, |
325 | 325 | $sortBy |
326 | 326 | ) { |
327 | 327 | return ( |
328 | - ($resource->isGlobal ? 'a-' : 'z-') . $resource->$sortBy |
|
328 | + ($resource->isGlobal ? 'a-' : 'z-').$resource->$sortBy |
|
329 | 329 | ); |
330 | 330 | }); |
331 | 331 | }); |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | private function getNotifiableUsers() |
15 | 15 | { |
16 | 16 | return collect(config('health.notifications.users.emails'))->map( |
17 | - function ($item) { |
|
17 | + function($item) { |
|
18 | 18 | $model = instantiate( |
19 | 19 | config('health.notifications.users.model') |
20 | 20 | ); |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | public function handle(RaiseHealthIssue $event) |
36 | 36 | { |
37 | 37 | try { |
38 | - $event->failure->targets->each(function ($target) use ($event) { |
|
38 | + $event->failure->targets->each(function($target) use ($event) { |
|
39 | 39 | if (!$target->result->healthy) { |
40 | 40 | Notification::send( |
41 | 41 | $this->getNotifiableUsers(), |