1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* Copyright (C) 2018 |
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\Core\Exception; |
18
|
|
|
|
19
|
|
|
use CuyZ\Notiz\Core\Definition\Tree\Definition; |
20
|
|
|
use CuyZ\Notiz\Core\Definition\Tree\EventGroup\EventGroup; |
21
|
|
|
use CuyZ\Notiz\Domain\Notification\Email\Application\EntityEmail\Settings\View\Layout; |
22
|
|
|
use CuyZ\Notiz\Domain\Notification\Slack\Application\EntitySlack\Settings\Channels\Channel; |
23
|
|
|
|
24
|
|
|
class EntryNotFoundException extends NotizException |
25
|
|
|
{ |
26
|
|
|
const DEFINITION_SOURCE_NOT_FOUND = 'The definition source `%s` was not registered yet.'; |
27
|
|
|
|
28
|
|
|
const DEFINITION_PROCESSOR_NOT_FOUND = 'The definition processor `%s` was not registered yet.'; |
29
|
|
|
|
30
|
|
|
const DEFINITION_EVENT_GROUP_NOT_FOUND = 'The event group `%s` was not found, please use method `%s::hasEventGroup()`.'; |
31
|
|
|
|
32
|
|
|
const DEFINITION_EVENT_NOT_FOUND = 'The event `%s` was not found, please use method `%s::hasEvent()`.'; |
33
|
|
|
|
34
|
|
|
const DEFINITION_EVENT_FULL_IDENTIFIER_NOT_FOUND = 'The event with a full identifier `%s` was not found.'; |
35
|
|
|
|
36
|
|
|
const DEFINITION_NOTIFICATION_NOT_FOUND = 'The notification `%s` was not found, please use method `%s::hasNotification()`.'; |
37
|
|
|
|
38
|
|
|
const ENTITY_EMAIL_VIEW_LAYOUT_NOT_FOUND = 'The view layout `%s` was not found, please use method `%s::hasLayout()`.'; |
39
|
|
|
|
40
|
|
|
const PROPERTY_ENTRY_NOT_FOUND = 'The property `%s` for the event `%s` does not have an entry `%s`, please use method `%s::hasEntry()`.'; |
41
|
|
|
|
42
|
|
|
const EXTENSION_CONFIGURATION_ENTRY_NOT_FOUND = 'The entry `%s` was not found in the extension configuration.'; |
43
|
|
|
|
44
|
|
|
const EVENT_RUNNER_ENTRY_NOT_FOUND = 'The runner entry `%s` was not found, please use method `%s::has()`.'; |
45
|
|
|
|
46
|
|
|
const EVENT_CONNECTION_TYPE_MISSING = 'The property `type` must be filled with one of these values: `%s`.'; |
47
|
|
|
|
48
|
|
|
const ENTITY_SLACK_BOT_NOT_FOUND = 'The Slack bot `%s` was not found.'; |
49
|
|
|
|
50
|
|
|
const ENTITY_SLACK_CHANNEL_DEFINITION_NOT_FOUND = 'The channel definition `%s` was not found, please use method `%s::hasChannel()`.'; |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* @param string $identifier |
54
|
|
|
* @return static |
55
|
|
|
*/ |
56
|
|
|
public static function definitionSourceNotFound($identifier) |
57
|
|
|
{ |
58
|
|
|
return self::makeNewInstance( |
59
|
|
|
self::DEFINITION_SOURCE_NOT_FOUND, |
60
|
|
|
1503849730, |
61
|
|
|
[$identifier] |
62
|
|
|
); |
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* @param string $identifier |
67
|
|
|
* @return static |
68
|
|
|
*/ |
69
|
|
|
public static function definitionProcessorNotFound($identifier) |
70
|
|
|
{ |
71
|
|
|
return self::makeNewInstance( |
72
|
|
|
self::DEFINITION_PROCESSOR_NOT_FOUND, |
73
|
|
|
1503850164, |
74
|
|
|
[$identifier] |
75
|
|
|
); |
76
|
|
|
} |
77
|
|
|
|
78
|
|
|
/** |
79
|
|
|
* @param string $identifier |
80
|
|
|
* @return static |
81
|
|
|
*/ |
82
|
|
|
public static function definitionEventGroupNotFound($identifier) |
83
|
|
|
{ |
84
|
|
|
return self::makeNewInstance( |
85
|
|
|
self::DEFINITION_EVENT_GROUP_NOT_FOUND, |
86
|
|
|
1503851646, |
87
|
|
|
[$identifier, Definition::class] |
88
|
|
|
); |
89
|
|
|
} |
90
|
|
|
|
91
|
|
|
/** |
92
|
|
|
* @param string $identifier |
93
|
|
|
* @return static |
94
|
|
|
*/ |
95
|
|
|
public static function definitionEventNotFound($identifier) |
96
|
|
|
{ |
97
|
|
|
return self::makeNewInstance( |
98
|
|
|
self::DEFINITION_EVENT_NOT_FOUND, |
99
|
|
|
1503851804, |
100
|
|
|
[$identifier, EventGroup::class] |
101
|
|
|
); |
102
|
|
|
} |
103
|
|
|
|
104
|
|
|
/** |
105
|
|
|
* @param string $fullIdentifier |
106
|
|
|
* @return static |
107
|
|
|
*/ |
108
|
|
|
public static function definitionEventFullIdentifierNotFound($fullIdentifier) |
109
|
|
|
{ |
110
|
|
|
return self::makeNewInstance( |
111
|
|
|
self::DEFINITION_EVENT_FULL_IDENTIFIER_NOT_FOUND, |
112
|
|
|
1520251011, |
113
|
|
|
[$fullIdentifier] |
114
|
|
|
); |
115
|
|
|
} |
116
|
|
|
|
117
|
|
|
/** |
118
|
|
|
* @param string $identifier |
119
|
|
|
* @return static |
120
|
|
|
*/ |
121
|
|
|
public static function definitionNotificationNotFound($identifier) |
122
|
|
|
{ |
123
|
|
|
return self::makeNewInstance( |
124
|
|
|
self::DEFINITION_NOTIFICATION_NOT_FOUND, |
125
|
|
|
1510506078, |
126
|
|
|
[$identifier, Definition::class] |
127
|
|
|
); |
128
|
|
|
} |
129
|
|
|
|
130
|
|
|
/** |
131
|
|
|
* @param string $identifier |
132
|
|
|
* @return static |
133
|
|
|
*/ |
134
|
|
|
public static function entityEmailViewLayoutNotFound($identifier) |
135
|
|
|
{ |
136
|
|
|
return self::makeNewInstance( |
137
|
|
|
self::ENTITY_EMAIL_VIEW_LAYOUT_NOT_FOUND, |
138
|
|
|
1503851908, |
139
|
|
|
[$identifier, Layout::class] |
140
|
|
|
); |
141
|
|
|
} |
142
|
|
|
|
143
|
|
|
/** |
144
|
|
|
* @param string $name |
145
|
|
|
* @param string $eventClassName |
146
|
|
|
* @param string $propertyType |
147
|
|
|
* @param object $object |
148
|
|
|
* @return static |
149
|
|
|
*/ |
150
|
|
|
public static function propertyEntryNotFound($name, $eventClassName, $propertyType, $object) |
151
|
|
|
{ |
152
|
|
|
return self::makeNewInstance( |
153
|
|
|
self::PROPERTY_ENTRY_NOT_FOUND, |
154
|
|
|
1504104832, |
155
|
|
|
[$propertyType, $eventClassName, $name, get_class($object)] |
156
|
|
|
); |
157
|
|
|
} |
158
|
|
|
|
159
|
|
|
/** |
160
|
|
|
* @param string $key |
161
|
|
|
* @return static |
162
|
|
|
*/ |
163
|
|
|
public static function extensionConfigurationEntryNotFound($key) |
164
|
|
|
{ |
165
|
|
|
return self::makeNewInstance( |
166
|
|
|
self::EXTENSION_CONFIGURATION_ENTRY_NOT_FOUND, |
167
|
|
|
1506239859, |
168
|
|
|
[$key] |
169
|
|
|
); |
170
|
|
|
} |
171
|
|
|
|
172
|
|
|
/** |
173
|
|
|
* @param string $key |
174
|
|
|
* @return static |
175
|
|
|
*/ |
176
|
|
|
public static function eventRunnerEntryNotFound($key) |
177
|
|
|
{ |
178
|
|
|
return self::makeNewInstance( |
179
|
|
|
self::EVENT_RUNNER_ENTRY_NOT_FOUND, |
180
|
|
|
1506246269, |
181
|
|
|
[$key] |
182
|
|
|
); |
183
|
|
|
} |
184
|
|
|
|
185
|
|
|
/** |
186
|
|
|
* @param array $allowedTypes |
187
|
|
|
* @return static |
188
|
|
|
*/ |
189
|
|
|
public static function eventConnectionTypeMissing(array $allowedTypes) |
190
|
|
|
{ |
191
|
|
|
return self::makeNewInstance( |
192
|
|
|
self::EVENT_CONNECTION_TYPE_MISSING, |
193
|
|
|
1509630193, |
194
|
|
|
[implode('`, `', $allowedTypes)] |
195
|
|
|
); |
196
|
|
|
} |
197
|
|
|
|
198
|
|
|
/** |
199
|
|
|
* @param string $botIdentifier |
200
|
|
|
* @return static |
201
|
|
|
*/ |
202
|
|
|
public static function entitySlackBotNotFound($botIdentifier) |
203
|
|
|
{ |
204
|
|
|
return self::makeNewInstance( |
205
|
|
|
self::ENTITY_SLACK_BOT_NOT_FOUND, |
206
|
|
|
1519770222, |
207
|
|
|
[$botIdentifier] |
208
|
|
|
); |
209
|
|
|
} |
210
|
|
|
|
211
|
|
|
/** |
212
|
|
|
* @param string $identifier |
213
|
|
|
* @return static |
214
|
|
|
*/ |
215
|
|
|
public static function entitySlackChannelDefinitionNotFound($identifier) |
216
|
|
|
{ |
217
|
|
|
return self::makeNewInstance( |
218
|
|
|
self::ENTITY_SLACK_CHANNEL_DEFINITION_NOT_FOUND, |
219
|
|
|
1524661834, |
220
|
|
|
[$identifier, Channel::class] |
221
|
|
|
); |
222
|
|
|
} |
223
|
|
|
} |
224
|
|
|
|