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