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\Item\AbstractMiddleware; |
17
|
|
|
use Romm\Formz\Middleware\Signal\SendsMiddlewareSignal; |
18
|
|
|
|
19
|
|
|
class InvalidEntryException extends FormzException |
20
|
|
|
{ |
21
|
|
|
const INVALID_CSS_CLASS_NAMESPACE = 'The class "%s" is not valid: the namespace of the error must be one of the following: %s.'; |
22
|
|
|
|
23
|
|
|
const MIDDLEWARE_NOT_SENDING_SIGNALS = 'The middleware "%s" does not implement interface "%s", therefore it can not dispatch signals.'; |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* @code 1467623504 |
27
|
|
|
* |
28
|
|
|
* @param string $className |
29
|
|
|
* @param array $acceptedClassesNameSpace |
30
|
|
|
* @return self |
31
|
|
|
*/ |
32
|
|
|
final public static function invalidCssClassNamespace($className, array $acceptedClassesNameSpace) |
33
|
|
|
{ |
34
|
|
|
/** @var self $exception */ |
35
|
|
|
$exception = self::getNewExceptionInstance( |
36
|
|
|
self::INVALID_CSS_CLASS_NAMESPACE, |
37
|
|
|
[$className, implode(', ', $acceptedClassesNameSpace)] |
38
|
|
|
); |
39
|
|
|
|
40
|
|
|
return $exception; |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* @code 1490798324 |
45
|
|
|
* |
46
|
|
|
* @param AbstractMiddleware $middleware |
47
|
|
|
* @return InvalidEntryException |
48
|
|
|
*/ |
49
|
|
|
final public static function middlewareNotSendingSignals(AbstractMiddleware $middleware) |
50
|
|
|
{ |
51
|
|
|
/** @var self $exception */ |
52
|
|
|
$exception = self::getNewExceptionInstance( |
53
|
|
|
self::MIDDLEWARE_NOT_SENDING_SIGNALS, |
54
|
|
|
[get_class($middleware), SendsMiddlewareSignal::class] |
55
|
|
|
); |
56
|
|
|
|
57
|
|
|
return $exception; |
58
|
|
|
} |
59
|
|
|
} |
60
|
|
|
|