@@ -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 | } |