|
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\Signal\SendsMiddlewareSignal; |
|
17
|
|
|
|
|
18
|
|
|
use Romm\Formz\Form\FormInterface; |
|
19
|
|
|
|
|
20
|
|
|
class InvalidArgumentValueException extends FormzException |
|
21
|
|
|
{ |
|
22
|
|
|
const FIELD_VIEW_HELPER_EMPTY_LAYOUT = 'The layout name cannot be empty, please fill with a value.'; |
|
23
|
|
|
|
|
24
|
|
|
const SIGNAL_NOT_ALLOWED = 'Trying to dispatch a signal that was not allowed by the middleware "%s". Authorized signals for this middleware are: "%s".'; |
|
25
|
|
|
|
|
26
|
|
|
const FORM_NAME_EMPTY = 'The name of the form (type: "%s") can not be empty.'; |
|
27
|
|
|
|
|
28
|
|
|
/** |
|
29
|
|
|
* @code 1485786285 |
|
30
|
|
|
* |
|
31
|
|
|
* @return self |
|
32
|
|
|
*/ |
|
33
|
|
|
final public static function fieldViewHelperEmptyLayout() |
|
34
|
|
|
{ |
|
35
|
|
|
/** @var self $exception */ |
|
36
|
|
|
$exception = self::getNewExceptionInstance(self::FIELD_VIEW_HELPER_EMPTY_LAYOUT); |
|
37
|
|
|
|
|
38
|
|
|
return $exception; |
|
39
|
|
|
} |
|
40
|
|
|
|
|
41
|
|
|
/** |
|
42
|
|
|
* @code 1490798201 |
|
43
|
|
|
* |
|
44
|
|
|
* @param SendsMiddlewareSignal $middleware |
|
45
|
|
|
* @return InvalidArgumentValueException |
|
46
|
|
|
*/ |
|
47
|
|
|
final public static function signalNotAllowed(SendsMiddlewareSignal $middleware) |
|
48
|
|
|
{ |
|
49
|
|
|
/** @var self $exception */ |
|
50
|
|
|
$exception = self::getNewExceptionInstance( |
|
51
|
|
|
self::SIGNAL_NOT_ALLOWED, |
|
52
|
|
|
[ |
|
53
|
|
|
get_class($middleware), |
|
54
|
|
|
implode('", "', $middleware->getAllowedSignals()) |
|
55
|
|
|
] |
|
56
|
|
|
); |
|
57
|
|
|
|
|
58
|
|
|
return $exception; |
|
59
|
|
|
} |
|
60
|
|
|
|
|
61
|
|
|
/** |
|
62
|
|
|
* @code 1494515073 |
|
63
|
|
|
* |
|
64
|
|
|
* @param FormInterface $form |
|
65
|
|
|
* @return self |
|
66
|
|
|
*/ |
|
67
|
|
|
final public static function formNameEmpty(FormInterface $form) |
|
68
|
|
|
{ |
|
69
|
|
|
/** @var self $exception */ |
|
70
|
|
|
$exception = self::getNewExceptionInstance( |
|
71
|
|
|
self::FORM_NAME_EMPTY, |
|
72
|
|
|
[get_class($form)] |
|
73
|
|
|
); |
|
74
|
|
|
|
|
75
|
|
|
return $exception; |
|
76
|
|
|
} |
|
77
|
|
|
} |
|
78
|
|
|
|