ILIAS  trunk Revision v12.0_alpha-377-g3641b37b9db
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 REGEX_CONFIG_EXCEPTION = 8;
29 protected ilLanguage $lng;
30 protected int $exception_type;
31
32 public function __construct(int $exception_type)
33 {
34 global $DIC;
35 $this->lng = $DIC->language();
36
37 $this->exception_type = $exception_type;
38 parent::__construct($this->__toString(), $exception_type);
39 }
40
41 public function __toString(): string
42 {
43 switch ($this->exception_type) {
45 return $this->lng->txt('dcl_wrong_input_type');
47 return $this->lng->txt('dcl_wrong_length');
49 return $this->lng->txt('dcl_wrong_regex');
51 return $this->lng->txt('dcl_invalid_regex_config');
53 return $this->lng->txt('dcl_unique_exception');
54 case self::NOT_URL:
55 return $this->lng->txt('dcl_noturl_exception');
56 default:
57 return $this->lng->txt('dcl_unknown_exception');
58 }
59 }
60}
__construct(int $exception_type)
Base class for ILIAS Exception handling.
language handling
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26