ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilSystemStyleMessage.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
25{
26 public const TYPE_INFO = 0;
27 public const TYPE_SUCCESS = 1;
28 public const TYPE_ERROR = 2;
29
30 protected string $message = '';
32
33 public function __construct(string $message, int $type_id = self::TYPE_SUCCESS)
34 {
35 $this->setMessage($message);
36 $this->setTypeId($type_id);
37 }
38
39 public function getMessageOutput(): string
40 {
41 return $this->message . '</br>';
42 }
43
44 public function getMessage(): string
45 {
46 return $this->message;
47 }
48
49 public function setMessage(string $message): void
50 {
51 $this->message = $message;
52 }
53
54 public function getTypeId(): int
55 {
56 return $this->type_id;
57 }
58
62 public function setTypeId(int $type_id): void
63 {
64 if ($this->isValidTypeId($type_id)) {
65 $this->type_id = $type_id;
66 } else {
68 }
69 }
70
71 protected function isValidTypeId(int $type_id): bool
72 {
73 switch ($type_id) {
75 case self::TYPE_INFO:
77 return true;
78 default:
79 return false;
80 }
81 }
82}
Class for advanced editing exception handling in ILIAS.
__construct(string $message, int $type_id=self::TYPE_SUCCESS)