Passed
Pull Request — master (#44)
by Romain
03:33
created

EntryNotFoundException::slotNotFound()   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) 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
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
    /**
46
     * @param string $identifier
47
     * @return static
48
     */
49
    public static function definitionSourceNotFound($identifier)
50
    {
51
        return self::makeNewInstance(
52
            self::DEFINITION_SOURCE_NOT_FOUND,
53
            1503849730,
54
            [$identifier]
55
        );
56
    }
57
58
    /**
59
     * @param string $identifier
60
     * @return static
61
     */
62
    public static function definitionProcessorNotFound($identifier)
63
    {
64
        return self::makeNewInstance(
65
            self::DEFINITION_PROCESSOR_NOT_FOUND,
66
            1503850164,
67
            [$identifier]
68
        );
69
    }
70
71
    /**
72
     * @param string $identifier
73
     * @return static
74
     */
75
    public static function definitionEventGroupNotFound($identifier)
76
    {
77
        return self::makeNewInstance(
78
            self::DEFINITION_EVENT_GROUP_NOT_FOUND,
79
            1503851646,
80
            [$identifier, Definition::class]
81
        );
82
    }
83
84
    /**
85
     * @param string $identifier
86
     * @return static
87
     */
88
    public static function definitionEventNotFound($identifier)
89
    {
90
        return self::makeNewInstance(
91
            self::DEFINITION_EVENT_NOT_FOUND,
92
            1503851804,
93
            [$identifier, EventGroup::class]
94
        );
95
    }
96
97
    /**
98
     * @param string $identifier
99
     * @return static
100
     */
101
    public static function definitionNotificationNotFound($identifier)
102
    {
103
        return self::makeNewInstance(
104
            self::DEFINITION_NOTIFICATION_NOT_FOUND,
105
            1510506078,
106
            [$identifier, Definition::class]
107
        );
108
    }
109
110
    /**
111
     * @param string $identifier
112
     * @return static
113
     */
114
    public static function entityEmailViewLayoutNotFound($identifier)
115
    {
116
        return self::makeNewInstance(
117
            self::ENTITY_EMAIL_VIEW_LAYOUT_NOT_FOUND,
118
            1503851908,
119
            [$identifier, Layout::class]
120
        );
121
    }
122
123
    /**
124
     * @param string $name
125
     * @param string $eventClassName
126
     * @param string $propertyType
127
     * @param object $object
128
     * @return static
129
     */
130
    public static function propertyEntryNotFound($name, $eventClassName, $propertyType, $object)
131
    {
132
        return self::makeNewInstance(
133
            self::PROPERTY_ENTRY_NOT_FOUND,
134
            1504104832,
135
            [$propertyType, $eventClassName, $name, get_class($object)]
136
        );
137
    }
138
139
    /**
140
     * @param string $key
141
     * @return static
142
     */
143
    public static function extensionConfigurationEntryNotFound($key)
144
    {
145
        return self::makeNewInstance(
146
            self::EXTENSION_CONFIGURATION_ENTRY_NOT_FOUND,
147
            1506239859,
148
            [$key]
149
        );
150
    }
151
152
    /**
153
     * @param string $key
154
     * @return static
155
     */
156
    public static function eventRunnerEntryNotFound($key)
157
    {
158
        return self::makeNewInstance(
159
            self::EVENT_RUNNER_ENTRY_NOT_FOUND,
160
            1506246269,
161
            [$key]
162
        );
163
    }
164
165
    /**
166
     * @param array $allowedTypes
167
     * @return static
168
     */
169
    public static function eventConnectionTypeMissing(array $allowedTypes)
170
    {
171
        return self::makeNewInstance(
172
            self::EVENT_CONNECTION_TYPE_MISSING,
173
            1509630193,
174
            [implode('`, `', $allowedTypes)]
175
        );
176
    }
177
}
178