ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilDclInputException.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4require_once './Services/Exceptions/classes/class.ilException.php';
5
18{
19 const TYPE_EXCEPTION = 0;
21 const REGEX_EXCEPTION = 2;
23 const NOT_URL = 4;
24 const NOT_IMAGE = 5;
25 const WRONG_FILE_TYPE = 6;
26 const CUSTOM_MESSAGE = 7;
28
29
33 protected $exception_type;
34
39
40
45 {
47 $this->exception_type = $exception_type;
48 $this->additional_text = $additional_text;
49 }
50
51
55 public function getExceptionType()
56 {
58 }
59
60
64 public function __toString()
65 {
66 global $DIC;
67 $lng = $DIC['lng'];
68
69 switch ($this->exception_type) {
71 $message = $lng->txt('dcl_wrong_input_type');
72 break;
74 $message = $lng->txt('dcl_wrong_length');
75 break;
77 $message = $lng->txt('dcl_wrong_regex');
78 break;
80 $message = $lng->txt('dcl_invalid_regex_config');
81 break;
83 $message = $lng->txt('dcl_unique_exception');
84 break;
85 case self::NOT_URL:
86 $message = $lng->txt('dcl_noturl_exception');
87 break;
88 case self::NOT_IMAGE:
89 $message = $lng->txt('dcl_notimage_exception');
90 break;
92 $message = $lng->txt('dcl_not_supported_file_type');
93 break;
96 break;
97 default:
98 $message = $lng->txt('dcl_unknown_exception');
99 }
100
101 if (strlen($this->additional_text) > 0) {
103 }
104
105 return $message;
106 }
107}
An exception for terminatinating execution or to throw for unit testing.
Class ilDclBaseFieldModel.
__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: goto.php:24
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$lng
$message
Definition: xapiexit.php:14