comp = $comp; $this->json = json_decode($json, false); } else { throw new \Exception("JSON is required to use this class"); } } public function getMessage() { if($this->comp === "gitea") { $comp = new discord($this->json); return($comp->readableMessage()); } if($this->comp === "grafana") { $comp = new grafana($this->json); return($comp->readableMessage()); } if(isset($this->json->text)) { return $this->json->text; } if(isset($this->json->message) && isset($this->json->imageUrl)) { return $this->json->message . PHP_EOL . $this->json->imageUrl; } if(isset($this->json->message)) { return $this->json->message; } throw new \Exception("Error not compatible query!"); } public function getEventFilter() { if(isset($this->json->event) && $this->json->event) { return $this->json->event; } elseif(isset($_GET['event']) && $_GET['event']) { return $_GET['event']; } return false; } } ?>