|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* Copyright (C) 2017 |
|
5
|
|
|
* Nathan Boiron <[email protected]> |
|
6
|
|
|
* Romain Canon <[email protected]> |
|
7
|
|
|
* |
|
8
|
|
|
* This file is part of the TYPO3 NotiZ project. |
|
9
|
|
|
* It is free software; you can redistribute it and/or modify it |
|
10
|
|
|
* under the terms of the GNU General Public License, either |
|
11
|
|
|
* version 3 of the License, or any later version. |
|
12
|
|
|
* |
|
13
|
|
|
* For the full copyright and license information, see: |
|
14
|
|
|
* http://www.gnu.org/licenses/gpl-3.0.html |
|
15
|
|
|
*/ |
|
16
|
|
|
|
|
17
|
|
|
namespace CuyZ\Notiz\Exception; |
|
18
|
|
|
|
|
19
|
|
|
use CuyZ\Notiz\Definition\Tree\EventGroup\Event\Connection\Hook; |
|
20
|
|
|
|
|
21
|
|
|
class WrongFormatException extends NotizException |
|
22
|
|
|
{ |
|
23
|
|
|
const TAG_SERVICE_IDENTIFIER_WRONG_FORMAT = 'The given identifier for the property `%s` is not valid, given value is `%s`, a suggestion would be `%s`. The format must respect the following rules: "%s".'; |
|
24
|
|
|
|
|
25
|
|
|
const EVENT_HOOK_METHOD_NAME_WRONG_FORMAT = 'The method name for the hook connection at the path `%s` is not valid. Given value was `%s`. The name must begin with a letter or an underscore and contain only alphanumeric characters and underscores.'; |
|
26
|
|
|
|
|
27
|
|
|
const SLOT_NAME_WRONG_FORMAT = 'The name "%s" is not valid for a slot name. Please use only alphanumeric/underscore/minus characters.'; |
|
28
|
|
|
|
|
29
|
|
|
/** |
|
30
|
|
|
* @param string $propertyType |
|
31
|
|
|
* @param string $identifier |
|
32
|
|
|
* @param string $suggestion |
|
33
|
|
|
* @param string $rules |
|
34
|
|
|
* @return static |
|
35
|
|
|
*/ |
|
36
|
|
|
public static function tagServiceIdentifierWrongFormat($propertyType, $identifier, $suggestion, $rules) |
|
37
|
|
|
{ |
|
38
|
|
|
return self::makeNewInstance( |
|
39
|
|
|
self::TAG_SERVICE_IDENTIFIER_WRONG_FORMAT, |
|
40
|
|
|
1504169118, |
|
41
|
|
|
[$propertyType, $identifier, $suggestion, $rules] |
|
42
|
|
|
); |
|
43
|
|
|
} |
|
44
|
|
|
|
|
45
|
|
|
/** |
|
46
|
|
|
* @param string $methodName |
|
47
|
|
|
* @param Hook $hook |
|
48
|
|
|
* @return static |
|
49
|
|
|
*/ |
|
50
|
|
|
public static function eventHookMethodNameWrongFormat($methodName, Hook $hook) |
|
51
|
|
|
{ |
|
52
|
|
|
return self::makeNewInstance( |
|
53
|
|
|
self::EVENT_HOOK_METHOD_NAME_WRONG_FORMAT, |
|
54
|
|
|
1506800906, |
|
55
|
|
|
[$hook->getPath(), $methodName] |
|
56
|
|
|
); |
|
57
|
|
|
} |
|
58
|
|
|
|
|
59
|
|
|
/** |
|
60
|
|
|
* @param string $name |
|
61
|
|
|
* @return static |
|
62
|
|
|
*/ |
|
63
|
|
|
public static function slotNameWrongFormat($name) |
|
64
|
|
|
{ |
|
65
|
|
|
return self::makeNewInstance( |
|
66
|
|
|
self::SLOT_NAME_WRONG_FORMAT, |
|
67
|
|
|
1506800906, |
|
68
|
|
|
[$name] |
|
69
|
|
|
); |
|
70
|
|
|
} |
|
71
|
|
|
} |
|
72
|
|
|
|