|
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
|
|
|
use Romm\Formz\ViewHelpers\FormIdentifierHashViewHelper; |
|
18
|
|
|
|
|
19
|
|
|
class MissingArgumentException extends FormzException |
|
20
|
|
|
{ |
|
21
|
|
|
const ARGUMENT_MISSING = 'The argument "%s" was not found in the request.'; |
|
22
|
|
|
|
|
23
|
|
|
const SIGNAL_NAME_MISSING = 'No signal has been given to the signal dispatcher, used in the middleware "%s". This is because this middleware can dispatch several signals (namely "%s"); so you must indicate which signal to dispatch.'; |
|
24
|
|
|
|
|
25
|
|
|
/** |
|
26
|
|
|
* @code 1490179179 |
|
27
|
|
|
* |
|
28
|
|
|
* @return self |
|
29
|
|
|
*/ |
|
30
|
|
|
final public static function ajaxControllerNameArgumentNotSet() |
|
31
|
|
|
{ |
|
32
|
|
|
/** @var self $exception */ |
|
33
|
|
|
$exception = self::getNewExceptionInstance( |
|
34
|
|
|
self::ARGUMENT_MISSING, |
|
35
|
|
|
['name'] |
|
36
|
|
|
); |
|
37
|
|
|
|
|
38
|
|
|
return $exception; |
|
39
|
|
|
} |
|
40
|
|
|
|
|
41
|
|
|
/** |
|
42
|
|
|
* @code 1490179250 |
|
43
|
|
|
* |
|
44
|
|
|
* @return self |
|
45
|
|
|
*/ |
|
46
|
|
|
final public static function ajaxControllerClassNameArgumentNotSet() |
|
47
|
|
|
{ |
|
48
|
|
|
/** @var self $exception */ |
|
49
|
|
|
$exception = self::getNewExceptionInstance( |
|
50
|
|
|
self::ARGUMENT_MISSING, |
|
51
|
|
|
['className'] |
|
52
|
|
|
); |
|
53
|
|
|
|
|
54
|
|
|
return $exception; |
|
55
|
|
|
} |
|
56
|
|
|
|
|
57
|
|
|
/** |
|
58
|
|
|
* @code 1490793826 |
|
59
|
|
|
* |
|
60
|
|
|
* @param SendsMiddlewareSignal $middleware |
|
61
|
|
|
* @return self |
|
62
|
|
|
*/ |
|
63
|
|
|
final public static function signalNameArgumentMissing(SendsMiddlewareSignal $middleware) |
|
64
|
|
|
{ |
|
65
|
|
|
/** @var self $exception */ |
|
66
|
|
|
$exception = self::getNewExceptionInstance( |
|
67
|
|
|
self::SIGNAL_NAME_MISSING, |
|
68
|
|
|
[ |
|
69
|
|
|
get_class($middleware), |
|
70
|
|
|
implode('", "', $middleware->getAllowedSignals()) |
|
71
|
|
|
] |
|
72
|
|
|
); |
|
73
|
|
|
|
|
74
|
|
|
return $exception; |
|
75
|
|
|
} |
|
76
|
|
|
} |
|
77
|
|
|
|