ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilDclInputException.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22{
23 public const TYPE_EXCEPTION = 0;
24 public const LENGTH_EXCEPTION = 1;
25 public const REGEX_EXCEPTION = 2;
26 public const UNIQUE_EXCEPTION = 3;
27 public const NOT_URL = 4;
28 public const NOT_IMAGE = 5;
29 public const WRONG_FILE_TYPE = 6;
30 public const CUSTOM_MESSAGE = 7;
31 public const REGEX_CONFIG_EXCEPTION = 8;
32 protected ilLanguage $lng;
33
34 protected int $exception_type;
35 protected string $additional_text;
36
40 public function __construct(int $exception_type, $additional_text = "")
41 {
42 global $DIC;
43 $this->lng = $DIC->language();
44
45 $this->exception_type = $exception_type;
46 $this->additional_text = $additional_text;
47 parent::__construct($this->__toString(), $exception_type);
48 }
49
50 public function getExceptionType(): int
51 {
53 }
54
55 public function __toString(): string
56 {
57 switch ($this->exception_type) {
59 $message = $this->lng->txt('dcl_wrong_input_type');
60 break;
62 $message = $this->lng->txt('dcl_wrong_length');
63 break;
65 $message = $this->lng->txt('dcl_wrong_regex');
66 break;
68 $message = $this->lng->txt('dcl_invalid_regex_config');
69 break;
71 $message = $this->lng->txt('dcl_unique_exception');
72 break;
73 case self::NOT_URL:
74 $message = $this->lng->txt('dcl_noturl_exception');
75 break;
76 case self::NOT_IMAGE:
77 $message = $this->lng->txt('dcl_notimage_exception');
78 break;
80 $message = $this->lng->txt('dcl_not_supported_file_type');
81 break;
84 default:
85 $message = $this->lng->txt('dcl_unknown_exception');
86 }
87
88 if (strlen($this->additional_text) > 0) {
90 }
91
92 return $message;
93 }
94}
__construct(int $exception_type, $additional_text="")
Base class for ILIAS Exception handling.
language handling
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26
$message
Definition: xapiexit.php:31