@@ -101,7 +101,7 @@ |
||
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | /** |
| 104 | - * @return mixed|string |
|
| 104 | + * @return string |
|
| 105 | 105 | */ |
| 106 | 106 | public function getPath() |
| 107 | 107 | { |
@@ -2,7 +2,6 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace EricMakesStuff\ServerMonitor\Monitors; |
| 4 | 4 | |
| 5 | -use Carbon\Carbon; |
|
| 6 | 5 | use EricMakesStuff\ServerMonitor\Events\DiskUsageAlarm; |
| 7 | 6 | use EricMakesStuff\ServerMonitor\Events\DiskUsageHealthy; |
| 8 | 7 | use EricMakesStuff\ServerMonitor\Exceptions\InvalidPath; |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | */ |
| 50 | 50 | public function runMonitor() |
| 51 | 51 | { |
| 52 | - if (! file_exists($this->path)) { |
|
| 52 | + if (!file_exists($this->path)) { |
|
| 53 | 53 | throw InvalidPath::pathDoesNotExist($this->path); |
| 54 | 54 | } |
| 55 | 55 | |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | |
| 60 | 60 | $this->usedSpace = $this->totalSpace - $this->freeSpace; |
| 61 | 61 | |
| 62 | - $this->percentageUsed = sprintf('%.2f',($this->usedSpace / $this->totalSpace) * 100); |
|
| 62 | + $this->percentageUsed = sprintf('%.2f', ($this->usedSpace / $this->totalSpace) * 100); |
|
| 63 | 63 | |
| 64 | 64 | if ($this->percentageUsed >= $this->alarmPercentage) { |
| 65 | 65 | event(new DiskUsageAlarm($this)); |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | */ |
| 98 | 98 | public function getPercentageUsed() |
| 99 | 99 | { |
| 100 | - return $this->percentageUsed . '%'; |
|
| 100 | + return $this->percentageUsed.'%'; |
|
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | /** |
@@ -113,6 +113,6 @@ discard block |
||
| 113 | 113 | */ |
| 114 | 114 | public function getAlarmPercentage() |
| 115 | 115 | { |
| 116 | - return $this->alarmPercentage . '%'; |
|
| 116 | + return $this->alarmPercentage.'%'; |
|
| 117 | 117 | } |
| 118 | 118 | } |
@@ -28,7 +28,7 @@ |
||
| 28 | 28 | |
| 29 | 29 | public function send() |
| 30 | 30 | { |
| 31 | - $this->mailer->raw($this->message, function (Message $message) { |
|
| 31 | + $this->mailer->raw($this->message, function(Message $message) { |
|
| 32 | 32 | |
| 33 | 33 | $message |
| 34 | 34 | ->subject($this->subject) |
@@ -21,7 +21,7 @@ |
||
| 21 | 21 | { |
| 22 | 22 | $monitors = ServerMonitorFactory::createForMonitorConfig(config('server-monitor.monitors')); |
| 23 | 23 | |
| 24 | - $monitors->each(function (BaseMonitor $monitor) { |
|
| 24 | + $monitors->each(function(BaseMonitor $monitor) { |
|
| 25 | 25 | $monitor->runMonitor(); |
| 26 | 26 | }); |
| 27 | 27 | } |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | public function httpPingDown(HttpPingMonitor $httpPingMonitor) |
| 72 | 72 | { |
| 73 | 73 | $additionalInfo = ''; |
| 74 | - if ($httpPingMonitor->getCheckPhrase() && ! $httpPingMonitor->getResponseContainsPhrase()) { |
|
| 74 | + if ($httpPingMonitor->getCheckPhrase() && !$httpPingMonitor->getResponseContainsPhrase()) { |
|
| 75 | 75 | $additionalInfo = " Response did not contain \"{$httpPingMonitor->getCheckPhrase()}\""; |
| 76 | 76 | } |
| 77 | 77 | |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | $senderNames = config("server-monitor.notifications.events.{$eventName}"); |
| 95 | 95 | |
| 96 | 96 | collect($senderNames) |
| 97 | - ->map(function ($senderName) { |
|
| 97 | + ->map(function($senderName) { |
|
| 98 | 98 | $className = $senderName; |
| 99 | 99 | |
| 100 | 100 | if (file_exists(__DIR__.'/Senders/'.ucfirst($senderName).'.php')) { |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | |
| 104 | 104 | return app($className); |
| 105 | 105 | }) |
| 106 | - ->each(function (SendsNotifications $sender) use ($subject, $message, $type) { |
|
| 106 | + ->each(function(SendsNotifications $sender) use ($subject, $message, $type) { |
|
| 107 | 107 | try { |
| 108 | 108 | $sender |
| 109 | 109 | ->setSubject($subject) |
@@ -64,7 +64,7 @@ |
||
| 64 | 64 | $this->processCertificate($this->certificateInfo); |
| 65 | 65 | |
| 66 | 66 | if ($this->certificateDaysUntilExpiration < 0 |
| 67 | - || ! $this->hostCoveredByCertificate($urlParts['host'], $this->certificateDomain, $this->certificateAdditionalDomains)) { |
|
| 67 | + || !$this->hostCoveredByCertificate($urlParts['host'], $this->certificateDomain, $this->certificateAdditionalDomains)) { |
|
| 68 | 68 | event(new SSLCertificateInvalid($this)); |
| 69 | 69 | } elseif (in_array($this->certificateDaysUntilExpiration, $this->alarmDaysBeforeExpiration)) { |
| 70 | 70 | event(new SSLCertificateExpiring($this)); |
@@ -70,13 +70,13 @@ discard block |
||
| 70 | 70 | ]); |
| 71 | 71 | $response = $guzzle->get($this->url); |
| 72 | 72 | $this->responseCode = $response->getStatusCode(); |
| 73 | - $this->responseContent = (string)$response->getBody(); |
|
| 73 | + $this->responseContent = (string) $response->getBody(); |
|
| 74 | 74 | } catch (RequestException $e) { |
| 75 | 75 | $response = $e->getResponse(); |
| 76 | 76 | |
| 77 | 77 | if ($response instanceof ResponseInterface) { |
| 78 | 78 | $this->responseCode = $response->getStatusCode(); |
| 79 | - $this->responseContent = (string)$response->getBody(); |
|
| 79 | + $this->responseContent = (string) $response->getBody(); |
|
| 80 | 80 | } else { |
| 81 | 81 | $this->setResponseCodeAndContentOnException($e); |
| 82 | 82 | } |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | if ($this->responseCode != '200' |
| 89 | - || ! $this->checkResponseContains($this->responseContent, $this->checkPhrase)) { |
|
| 89 | + || !$this->checkResponseContains($this->responseContent, $this->checkPhrase)) { |
|
| 90 | 90 | event(new HttpPingDown($this)); |
| 91 | 91 | } else { |
| 92 | 92 | event(new HttpPingUp($this)); |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | protected function setResponseCodeAndContentOnException(\Exception $e) |
| 100 | 100 | { |
| 101 | 101 | $this->responseCode = null; |
| 102 | - $this->responseContent = $e->getMessage() . PHP_EOL . $e->getTraceAsString(); |
|
| 102 | + $this->responseContent = $e->getMessage().PHP_EOL.$e->getTraceAsString(); |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | protected function checkResponseContains($html, $phrase) |