definitionEventGroupNotFound()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

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