$this->warningMessage = $message; $this->warning = true; } public function setSuccess($message) { $this->successMessage = $message; $this->success = true; } public function unsetError() { $this->error = false; } public function unsetWarning() { $this->warning = false; } public function unsetSuccess() { $this->success = false; } } $alerts = new Alerts(); if (isset($_GET['error'])) { $alerts->setError($_GET['error']); } if (isset($_GET['warning'])) { $alerts->setWarning($_GET['warning']); } if (isset($_GET['success'])) { $alerts->setSuccess($_GET['success']); }