ILIAS  release_8 Revision v8.24
class.ilDclInputException.php
Go to the documentation of this file.
1<?php
2
20{
21 public const TYPE_EXCEPTION = 0;
22 public const LENGTH_EXCEPTION = 1;
23 public const REGEX_EXCEPTION = 2;
24 public const UNIQUE_EXCEPTION = 3;
25 public const NOT_URL = 4;
26 public const NOT_IMAGE = 5;
27 public const WRONG_FILE_TYPE = 6;
28 public const CUSTOM_MESSAGE = 7;
29 public const REGEX_CONFIG_EXCEPTION = 8;
30
31 protected string $exception_type;
32 protected string $additional_text;
33
38 {
39 $this->exception_type = $exception_type;
40 $this->additional_text = $additional_text;
41 parent::__construct($this->__toString(), $exception_type);
42 }
43
44 public function getExceptionType(): string
45 {
47 }
48
49 public function __toString(): string
50 {
51 global $DIC;
52 $lng = $DIC['lng'];
53
54 switch ($this->exception_type) {
56 $message = $lng->txt('dcl_wrong_input_type');
57 break;
59 $message = $lng->txt('dcl_wrong_length');
60 break;
62 $message = $lng->txt('dcl_wrong_regex');
63 break;
65 $message = $lng->txt('dcl_invalid_regex_config');
66 break;
68 $message = $lng->txt('dcl_unique_exception');
69 break;
70 case self::NOT_URL:
71 $message = $lng->txt('dcl_noturl_exception');
72 break;
73 case self::NOT_IMAGE:
74 $message = $lng->txt('dcl_notimage_exception');
75 break;
77 $message = $lng->txt('dcl_not_supported_file_type');
78 break;
81 break;
82 default:
83 $message = $lng->txt('dcl_unknown_exception');
84 }
85
86 if (strlen($this->additional_text) > 0) {
88 }
89
90 return $message;
91 }
92}
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct($exception_type, $additional_text="")
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: feed.php:28
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$lng
$message
Definition: xapiexit.php:32