Skip to content

Commit

Permalink
Remove whitespaces
Browse files Browse the repository at this point in the history
  • Loading branch information
PedroBuffon committed Jul 12, 2024
1 parent 4986939 commit efda62e
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions Mailcow/Mailcow.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,45 +22,45 @@ public function livestats()
$status = "inactive";
$data = [];
$attrs = $this->getAttrs();

// Fetch mailboxes
$mailboxesResponse = parent::execute($this->url("mailbox/all"), $attrs);
$mailboxes = json_decode($mailboxesResponse->getBody());

// Count mailboxes
if ($mailboxes) {
$data["mailboxes"] = count($mailboxes);
} else {
$data["mailboxes"] = 0;
}

// Fetch clients
$domainsResponse = parent::execute($this->url("domain/all"), $attrs);
$domains = json_decode($domainsResponse->getBody());

// Count clients
if ($domains) {
$data["domains"] = count($domains);
} else {
$data["domains"] = 0;
}

// Fetch messages
$queueResponse = parent::execute($this->url("mailq/all"), $attrs);
$queue = json_decode($queueResponse->getBody());

// Count messages
if ($queue && isset($queue->messages)) {
$data["queue"] = count($queue->messages);
} else {
$data["queue"] = 0;
}

// Determine status based on data
if ($data["mailboxes"] > 0 || $data["domains"] > 0 || $data["queue"] >= 0) {
$status = "active";
}

return parent::getLiveStats($status, $data);
}

Expand All @@ -78,5 +78,4 @@ private function getAttrs()
],
];
}

}

0 comments on commit efda62e

Please sign in to comment.