@@ -33,15 +33,15 @@ |
||
| 33 | 33 | switch (substr($sizeStr, -1)) { |
| 34 | 34 | case 'M': |
| 35 | 35 | case 'm': |
| 36 | - return (int)$sizeStr; |
|
| 36 | + return (int) $sizeStr; |
|
| 37 | 37 | |
| 38 | 38 | case 'K': |
| 39 | 39 | case 'k': |
| 40 | - return (int)$sizeStr / 1024; |
|
| 40 | + return (int) $sizeStr / 1024; |
|
| 41 | 41 | |
| 42 | 42 | case 'G': |
| 43 | 43 | case 'g': |
| 44 | - return (int)$sizeStr * 1024; |
|
| 44 | + return (int) $sizeStr * 1024; |
|
| 45 | 45 | |
| 46 | 46 | default: |
| 47 | 47 | return $sizeStr; |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | |
| 33 | 33 | public function check(): void |
| 34 | 34 | { |
| 35 | - foreach($this->results as $group) { |
|
| 35 | + foreach ($this->results as $group) { |
|
| 36 | 36 | $group->check(); |
| 37 | 37 | } |
| 38 | 38 | } |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | public function hasErrors(): bool |
| 46 | 46 | { |
| 47 | 47 | $error = false; |
| 48 | - foreach($this->results as $group) { |
|
| 48 | + foreach ($this->results as $group) { |
|
| 49 | 49 | if ($group->hasErrors()) { |
| 50 | 50 | $error = true; |
| 51 | 51 | break; |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -require __DIR__ . '/../vendor/autoload.php'; |
|
| 2 | +require __DIR__.'/../vendor/autoload.php'; |
|
| 3 | 3 | |
| 4 | 4 | use BretRZaun\StatusPage\Check\PhpExtensionCheck; |
| 5 | 5 | use BretRZaun\StatusPage\Check\PhpIniCheck; |
@@ -44,10 +44,10 @@ discard block |
||
| 44 | 44 | |
| 45 | 45 | // determine if the user is allowed to see the details (based on their IP) |
| 46 | 46 | $whitelistPattern = '.*'; // this intentionally matches everything |
| 47 | -$showDetails = (bool)preg_match('|(?mi-Us)' . $whitelistPattern . '|', $_SERVER['REMOTE_ADDR']); |
|
| 47 | +$showDetails = (bool) preg_match('|(?mi-Us)'.$whitelistPattern.'|', $_SERVER['REMOTE_ADDR']); |
|
| 48 | 48 | |
| 49 | 49 | // use the built-in Twig template |
| 50 | -$loader = new Twig_Loader_Filesystem(__DIR__ . '/../resources/views/'); |
|
| 50 | +$loader = new Twig_Loader_Filesystem(__DIR__.'/../resources/views/'); |
|
| 51 | 51 | $twig = new Twig_Environment($loader, ['autoescape' => false]); |
| 52 | 52 | |
| 53 | 53 | $content = $twig->render( |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | */ |
| 48 | 48 | public function check(): void |
| 49 | 49 | { |
| 50 | - foreach($this->checks as $checker) { |
|
| 50 | + foreach ($this->checks as $checker) { |
|
| 51 | 51 | /* @var $checker CheckInterface */ |
| 52 | 52 | $this->results[] = $checker->checkStatus(); |
| 53 | 53 | } |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | public function hasErrors(): bool |
| 72 | 72 | { |
| 73 | 73 | $error = false; |
| 74 | - foreach($this->results as $result) { |
|
| 74 | + foreach ($this->results as $result) { |
|
| 75 | 75 | if (!$result->getSuccess()) { |
| 76 | 76 | $error = true; |
| 77 | 77 | break; |
@@ -38,10 +38,10 @@ discard block |
||
| 38 | 38 | { |
| 39 | 39 | $strings = []; |
| 40 | 40 | if (null !== $this->greaterEquals) { |
| 41 | - $strings[] = '>=' . $this->greaterEquals; |
|
| 41 | + $strings[] = '>='.$this->greaterEquals; |
|
| 42 | 42 | } |
| 43 | 43 | if (null !== $this->lessThan) { |
| 44 | - $strings[] = '<' . $this->lessThan; |
|
| 44 | + $strings[] = '<'.$this->lessThan; |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | return implode(' and ', $strings); |
@@ -79,10 +79,10 @@ discard block |
||
| 79 | 79 | $version = $this->getExtensionVersion(); |
| 80 | 80 | if ((null !== $this->greaterEquals && !version_compare($this->greaterEquals, $version, '<=')) || |
| 81 | 81 | (null !== $this->lessThan && !version_compare($this->lessThan, $version, '>'))) { |
| 82 | - $result->setError('Extension ' . $this->extension . ' loaded, but version ' . $version . ' not supported<br/>Version must be ' . $this->getVersionConstraintString()); |
|
| 82 | + $result->setError('Extension '.$this->extension.' loaded, but version '.$version.' not supported<br/>Version must be '.$this->getVersionConstraintString()); |
|
| 83 | 83 | } |
| 84 | 84 | } else { |
| 85 | - $result->setError('Extension ' . $this->extension . ' is missing'); |
|
| 85 | + $result->setError('Extension '.$this->extension.' is missing'); |
|
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | return $result; |
@@ -1,7 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | namespace BretRZaun\StatusPage\Check; |
| 3 | 3 | use MongoDB\Client; |
| 4 | - |
|
| 5 | 4 | use BretRZaun\StatusPage\Result; |
| 6 | 5 | |
| 7 | 6 | class MongoDbCheck extends AbstractCheck |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | if (count($this->collections) > 0) { |
| 43 | 43 | $this->checkCollections($dbs); |
| 44 | 44 | } |
| 45 | - } catch(\Exception $e) { |
|
| 45 | + } catch (\Exception $e) { |
|
| 46 | 46 | $result->setError($e->getMessage()); |
| 47 | 47 | } |
| 48 | 48 | return $result; |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | |
| 51 | 51 | private function checkDatabases($databases) |
| 52 | 52 | { |
| 53 | - foreach($this->databases as $database) { |
|
| 53 | + foreach ($this->databases as $database) { |
|
| 54 | 54 | if (!in_array($database, $databases)) { |
| 55 | 55 | throw new \RuntimeException('Database '.$database.' does not exist'); |
| 56 | 56 | } |
@@ -59,10 +59,10 @@ discard block |
||
| 59 | 59 | |
| 60 | 60 | private function checkCollections(array $databases) |
| 61 | 61 | { |
| 62 | - foreach($this->collections as $databaseName => $collections) { |
|
| 62 | + foreach ($this->collections as $databaseName => $collections) { |
|
| 63 | 63 | $database = $this->client->selectDatabase($databaseName); |
| 64 | 64 | $collectionNames = $database->listCollectionNames()->getArrayCopy(); |
| 65 | - foreach($collections as $collection) { |
|
| 65 | + foreach ($collections as $collection) { |
|
| 66 | 66 | if (!in_array($collection, $collectionNames)) { |
| 67 | 67 | throw new \RuntimeException('Collection '.$collection.' does not exist in database '.$databaseName); |
| 68 | 68 | } |