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 5edc901 commit fb2a18e
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions Gotify/Gotify.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 applications
$applicationsResponse = parent::execute($this->url("application"), $attrs);
$applications = json_decode($applicationsResponse->getBody());

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

// Fetch clients
$clientsResponse = parent::execute($this->url("client"), $attrs);
$clients = json_decode($clientsResponse->getBody());

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

// Fetch messages
$messagesResponse = parent::execute($this->url("message"), $attrs);
$messages = json_decode($messagesResponse->getBody());

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

// Determine status based on data
if ($data["applications"] > 0 || $data["clients"] > 0 || $data["messages"] > 0) {
$status = "active";
}

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

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

}

0 comments on commit fb2a18e

Please sign in to comment.