1
|
|
|
<?php |
2
|
|
|
/* |
3
|
|
|
* 2017 Romain CANON <[email protected]> |
4
|
|
|
* |
5
|
|
|
* This file is part of the TYPO3 FormZ project. |
6
|
|
|
* It is free software; you can redistribute it and/or modify it |
7
|
|
|
* under the terms of the GNU General Public License, either |
8
|
|
|
* version 3 of the License, or any later version. |
9
|
|
|
* |
10
|
|
|
* For the full copyright and license information, see: |
11
|
|
|
* http://www.gnu.org/licenses/gpl-3.0.html |
12
|
|
|
*/ |
13
|
|
|
|
14
|
|
|
namespace Romm\Formz\Exceptions; |
15
|
|
|
|
16
|
|
|
use Romm\Formz\Middleware\Option\OptionDefinitionInterface; |
17
|
|
|
|
18
|
|
|
class ClassNotFoundException extends FormzException |
19
|
|
|
{ |
20
|
|
|
const WRONG_ASSET_HANDLER_CLASS_NAME = 'Trying to get an asset handler with a wrong class name: "%s".'; |
21
|
|
|
|
22
|
|
|
const WRONG_FORM_CLASS_NAME = 'Invalid form class name given: "%s".'; |
23
|
|
|
|
24
|
|
|
const FORM_VIEW_HELPER_CLASS_NOT_FOUND = 'Invalid value for the form class name (current value: "%s"). You need to either fill the parameter `formClassName` in the view helper, or specify the type of the parameter `$%s` for the method "%s::%s()".'; |
25
|
|
|
|
26
|
|
|
const BACKEND_CACHE_CLASS_NAME_NOT_FOUND = 'The cache class name given in configuration "config.tx_formz.settings.defaultBackendCache" was not found (current value: "%s")'; |
27
|
|
|
|
28
|
|
|
const CONDITION_CLASS_NAME_NOT_FOUND = 'The class name for the condition "%s" was not found (given value: "%s").'; |
29
|
|
|
|
30
|
|
|
const MIDDLEWARE_CLASS_NAME_NOT_FOUND = 'The class name "%s" was not found.'; |
31
|
|
|
|
32
|
|
|
const MIDDLEWARE_OPTIONS_PROPERTY_CLASS_NAME_NOT_FOUND = 'The `@var` annotation of the property `%s::$%s` is not correct: it must be filled the name of a class that implements `%s`. Current value of the annotation is `%s`.'; |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* @code 1489602455 |
36
|
|
|
* |
37
|
|
|
* @param string $name |
38
|
|
|
* @param string $className |
39
|
|
|
* @return self |
40
|
|
|
*/ |
41
|
|
|
final public static function conditionClassNameNotFound($name, $className) |
42
|
|
|
{ |
43
|
|
|
/** @var self $exception */ |
44
|
|
|
$exception = self::getNewExceptionInstance( |
45
|
|
|
self::CONDITION_CLASS_NAME_NOT_FOUND, |
46
|
|
|
[$name, $className] |
47
|
|
|
); |
48
|
|
|
|
49
|
|
|
return $exception; |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* @code 1477468381 |
54
|
|
|
* |
55
|
|
|
* @param string $className |
56
|
|
|
* @return self |
57
|
|
|
*/ |
58
|
|
|
final public static function wrongAssetHandlerClassName($className) |
59
|
|
|
{ |
60
|
|
|
/** @var self $exception */ |
61
|
|
|
$exception = self::getNewExceptionInstance( |
62
|
|
|
self::WRONG_ASSET_HANDLER_CLASS_NAME, |
63
|
|
|
[$className] |
64
|
|
|
); |
65
|
|
|
|
66
|
|
|
return $exception; |
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
/** |
70
|
|
|
* @code 1467191011 |
71
|
|
|
* |
72
|
|
|
* @param string $className |
73
|
|
|
* @return self |
74
|
|
|
*/ |
75
|
|
|
final public static function wrongFormClassName($className) |
76
|
|
|
{ |
77
|
|
|
/** @var self $exception */ |
78
|
|
|
$exception = self::getNewExceptionInstance( |
79
|
|
|
self::WRONG_FORM_CLASS_NAME, |
80
|
|
|
[$className] |
81
|
|
|
); |
82
|
|
|
|
83
|
|
|
return $exception; |
84
|
|
|
} |
85
|
|
|
|
86
|
|
|
/** |
87
|
|
|
* @code 1457442014 |
88
|
|
|
* |
89
|
|
|
* @param string $formClassName |
90
|
|
|
* @param string $formName |
91
|
|
|
* @param string $controller |
92
|
|
|
* @param string $action |
93
|
|
|
* @return self |
94
|
|
|
*/ |
95
|
|
|
final public static function formViewHelperClassNotFound($formClassName, $formName, $controller, $action) |
96
|
|
|
{ |
97
|
|
|
/** @var self $exception */ |
98
|
|
|
$exception = self::getNewExceptionInstance( |
99
|
|
|
self::FORM_VIEW_HELPER_CLASS_NOT_FOUND, |
100
|
|
|
[$formClassName, $formName, $controller, $action . 'Action'] |
101
|
|
|
); |
102
|
|
|
|
103
|
|
|
return $exception; |
104
|
|
|
} |
105
|
|
|
|
106
|
|
|
/** |
107
|
|
|
* @code 1488475103 |
108
|
|
|
* |
109
|
|
|
* @param string $className |
110
|
|
|
* @return self |
111
|
|
|
*/ |
112
|
|
|
final public static function backendCacheClassNameNotFound($className) |
113
|
|
|
{ |
114
|
|
|
/** @var self $exception */ |
115
|
|
|
$exception = self::getNewExceptionInstance( |
116
|
|
|
self::BACKEND_CACHE_CLASS_NAME_NOT_FOUND, |
117
|
|
|
[$className] |
118
|
|
|
); |
119
|
|
|
|
120
|
|
|
return $exception; |
121
|
|
|
} |
122
|
|
|
|
123
|
|
|
/** |
124
|
|
|
* @code 1490179346 |
125
|
|
|
* |
126
|
|
|
* @param string $className |
127
|
|
|
* @return self |
128
|
|
|
*/ |
129
|
|
|
final public static function ajaxControllerFormClassNameNotFound($className) |
130
|
|
|
{ |
131
|
|
|
/** @var self $exception */ |
132
|
|
|
$exception = self::getNewExceptionInstance( |
133
|
|
|
self::WRONG_FORM_CLASS_NAME, |
134
|
|
|
[$className] |
135
|
|
|
); |
136
|
|
|
|
137
|
|
|
return $exception; |
138
|
|
|
} |
139
|
|
|
|
140
|
|
|
/** |
141
|
|
|
* @code 1490180343 |
142
|
|
|
* |
143
|
|
|
* @param string $className |
144
|
|
|
* @return self |
145
|
|
|
*/ |
146
|
|
|
final public static function middlewareClassNameNotFound($className) |
147
|
|
|
{ |
148
|
|
|
/** @var self $exception */ |
149
|
|
|
$exception = self::getNewExceptionInstance( |
150
|
|
|
self::MIDDLEWARE_CLASS_NAME_NOT_FOUND, |
151
|
|
|
[$className] |
152
|
|
|
); |
153
|
|
|
|
154
|
|
|
return $exception; |
155
|
|
|
} |
156
|
|
|
|
157
|
|
|
/** |
158
|
|
|
* @code 1502658604 |
159
|
|
|
* |
160
|
|
|
* @param string $middlewareClassName |
161
|
|
|
* @param string $propertyType |
162
|
|
|
* @return ClassNotFoundException |
163
|
|
|
*/ |
164
|
|
|
final public static function middlewareOptionsPropertyClassNameNotFound($middlewareClassName, $propertyType) |
165
|
|
|
{ |
166
|
|
|
/** @var self $exception */ |
167
|
|
|
$exception = self::getNewExceptionInstance( |
168
|
|
|
self::MIDDLEWARE_OPTIONS_PROPERTY_CLASS_NAME_NOT_FOUND, |
169
|
|
|
[$middlewareClassName, 'options', OptionDefinitionInterface::class, (string)$propertyType] |
170
|
|
|
); |
171
|
|
|
|
172
|
|
|
return $exception; |
173
|
|
|
} |
174
|
|
|
} |
175
|
|
|
|