Passed
Pull Request — dev (#35)
by Romain
03:52
created

eventConnectionTypeMissing()   A

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 9.4285
c 0
b 0
f 0
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\Definition;
20
use CuyZ\Notiz\Definition\Tree\EventGroup\EventGroup;
21
use CuyZ\Notiz\Domain\Notification\Email\Application\EntityEmail\Settings\View\Layout;
22
23
class EntryNotFoundException extends NotizException
24
{
25
    const DEFINITION_SOURCE_NOT_FOUND = 'The definition source `%s` was not registered yet.';
26
27
    const DEFINITION_PROCESSOR_NOT_FOUND = 'The definition processor `%s` was not registered yet.';
28
29
    const DEFINITION_EVENT_GROUP_NOT_FOUND = 'The event group `%s` was not found, please use method `%s::hasEventGroup()`.';
30
31
    const DEFINITION_EVENT_NOT_FOUND = 'The event `%s` was not found, please use method `%s::hasEvent()`.';
32
33
    const DEFINITION_NOTIFICATION_NOT_FOUND = 'The notification `%s` was not found, please use method `%s::hasNotification()`.';
34
35
    const ENTITY_EMAIL_VIEW_LAYOUT_NOT_FOUND = 'The view layout `%s` was not found, please use method `%s::hasLayout()`.';
36
37
    const PROPERTY_ENTRY_NOT_FOUND = 'The property `%s` for the event `%s` does not have an entry `%s`, please use method `%s::hasEntry()`.';
38
39
    const EXTENSION_CONFIGURATION_ENTRY_NOT_FOUND = 'The entry `%s` was not found in the extension configuration.';
40
41
    const EVENT_RUNNER_ENTRY_NOT_FOUND = 'The runner entry `%s` was not found, please use method `%s::has()`.';
42
43
    const EVENT_CONNECTION_TYPE_MISSING = 'The property `type` must be filled with one of these values: `%s`.';
44
45
    const SLOT_NOT_FOUND = 'The slot named `%s` was not found, please register it in the `Slots` section of your template.';
46
47
    /**
48
     * @param string $identifier
49
     * @return static
50
     */
51
    public static function definitionSourceNotFound($identifier)
52
    {
53
        return self::makeNewInstance(
54
            self::DEFINITION_SOURCE_NOT_FOUND,
55
            1503849730,
56
            [$identifier]
57
        );
58
    }
59
60
    /**
61
     * @param string $identifier
62
     * @return static
63
     */
64
    public static function definitionProcessorNotFound($identifier)
65
    {
66
        return self::makeNewInstance(
67
            self::DEFINITION_PROCESSOR_NOT_FOUND,
68
            1503850164,
69
            [$identifier]
70
        );
71
    }
72
73
    /**
74
     * @param string $identifier
75
     * @return static
76
     */
77
    public static function definitionEventGroupNotFound($identifier)
78
    {
79
        return self::makeNewInstance(
80
            self::DEFINITION_EVENT_GROUP_NOT_FOUND,
81
            1503851646,
82
            [$identifier, Definition::class]
83
        );
84
    }
85
86
    /**
87
     * @param string $identifier
88
     * @return static
89
     */
90
    public static function definitionEventNotFound($identifier)
91
    {
92
        return self::makeNewInstance(
93
            self::DEFINITION_EVENT_NOT_FOUND,
94
            1503851804,
95
            [$identifier, EventGroup::class]
96
        );
97
    }
98
99
    /**
100
     * @param string $identifier
101
     * @return static
102
     */
103
    public static function definitionNotificationNotFound($identifier)
104
    {
105
        return self::makeNewInstance(
106
            self::DEFINITION_NOTIFICATION_NOT_FOUND,
107
            1510506078,
108
            [$identifier, Definition::class]
109
        );
110
    }
111
112
    /**
113
     * @param string $identifier
114
     * @return static
115
     */
116
    public static function entityEmailViewLayoutNotFound($identifier)
117
    {
118
        return self::makeNewInstance(
119
            self::ENTITY_EMAIL_VIEW_LAYOUT_NOT_FOUND,
120
            1503851908,
121
            [$identifier, Layout::class]
122
        );
123
    }
124
125
    /**
126
     * @param string $name
127
     * @param string $eventClassName
128
     * @param string $propertyType
129
     * @param object $object
130
     * @return static
131
     */
132
    public static function propertyEntryNotFound($name, $eventClassName, $propertyType, $object)
133
    {
134
        return self::makeNewInstance(
135
            self::PROPERTY_ENTRY_NOT_FOUND,
136
            1504104832,
137
            [$propertyType, $eventClassName, $name, get_class($object)]
138
        );
139
    }
140
141
    /**
142
     * @param string $key
143
     * @return static
144
     */
145
    public static function extensionConfigurationEntryNotFound($key)
146
    {
147
        return self::makeNewInstance(
148
            self::EXTENSION_CONFIGURATION_ENTRY_NOT_FOUND,
149
            1506239859,
150
            [$key]
151
        );
152
    }
153
154
    /**
155
     * @param string $key
156
     * @return static
157
     */
158
    public static function eventRunnerEntryNotFound($key)
159
    {
160
        return self::makeNewInstance(
161
            self::EVENT_RUNNER_ENTRY_NOT_FOUND,
162
            1506246269,
163
            [$key]
164
        );
165
    }
166
167
    /**
168
     * @param array $allowedTypes
169
     * @return static
170
     */
171
    public static function eventConnectionTypeMissing(array $allowedTypes)
172
    {
173
        return self::makeNewInstance(
174
            self::EVENT_CONNECTION_TYPE_MISSING,
175
            1509630193,
176
            [implode('`, `', $allowedTypes)]
177
        );
178
    }
179
180
    /**
181
     * @param string $name
182
     * @return static
183
     */
184
    public static function slotNotFound($name)
185
    {
186
        return self::makeNewInstance(
187
            self::SLOT_NOT_FOUND,
188
            1517410382,
189
            [$name]
190
        );
191
    }
192
}
193