Passed
Push — master ( b8fbdf...cacfa2 )
by Romain
03:12
created

InvalidClassException::eventHasMissingInterface()   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\Channel\Settings\ChannelSettings;
20
use CuyZ\Notiz\Core\Definition\Builder\Component\Processor\DefinitionProcessor;
21
use CuyZ\Notiz\Core\Definition\Builder\Component\Source\DefinitionSource;
22
use CuyZ\Notiz\Core\Event\Configuration\FlexForm\EventFlexFormProvider;
23
use CuyZ\Notiz\Core\Event\Event;
24
use CuyZ\Notiz\Core\Notification\Notification;
25
use CuyZ\Notiz\Core\Notification\Processor\NotificationProcessor;
26
use CuyZ\Notiz\Core\Notification\Settings\NotificationSettings;
27
use CuyZ\Notiz\Core\Property\PropertyEntry;
28
use CuyZ\Notiz\Core\Property\Support\PropertyBuilder;
29
30
class InvalidClassException extends NotizException
31
{
32
    const DEFINITION_SOURCE_MISSING_INTERFACE = 'The definition source class `%s` must implement the interface `%s`.';
33
34
    const DEFINITION_PROCESSOR_MISSING_INTERFACE = 'The definition processor class `%s` must implement the interface `%s`.';
35
36
    const EVENT_CLASS_MISSING_INTERFACE = 'The event class `%s` must implement the interface `%s`.';
37
38
    const TAG_SERVICE_PROPERTY_WRONG_PARENT = 'The given property class `%s` for identifier `%s` must extend the class `%s`.';
39
40
    const NOTIFICATION_MISSING_INTERFACE = 'The notification class `%s` must implement the interface `%s`.';
41
42
    const NOTIFICATION_PROCESSOR_WRONG_PARENT = 'The processor class of the notification `%s` must extend the class `%s` (given class is `%s`).';
43
44
    const NOTIFICATION_SETTINGS_MISSING_INTERFACE = 'The notification settings class `%s` must implement the interface `%s`.';
45
46
    const EVENT_CONFIGURATION_FLEX_FORM_PROVIDER_MISSING_INTERFACE = 'The FlexForm provider class `%s` must implement the interface `%s`.';
47
48
    const CHANNEL_SETTINGS_MISSING_INTERFACE = 'The channel settings class `%s` must implement the interface `%s`.';
49
50
    const EVENT_PROPERTY_BUILDER_MISSING_INTERFACE = 'The property builder `%s` must implement the interface `%s`.';
51
52
    /**
53
     * @param string $className
54
     * @return static
55
     */
56
    public static function definitionSourceHasMissingInterface($className)
57
    {
58
        return self::makeNewInstance(
59
            self::DEFINITION_SOURCE_MISSING_INTERFACE,
60
            1503849499,
61
            [$className, DefinitionSource::class]
62
        );
63
    }
64
65
    /**
66
     * @param string $className
67
     * @return static
68
     */
69
    public static function definitionProcessorHasMissingInterface($className)
70
    {
71
        return self::makeNewInstance(
72
            self::DEFINITION_PROCESSOR_MISSING_INTERFACE,
73
            1503850131,
74
            [$className, DefinitionProcessor::class]
75
        );
76
    }
77
78
    /**
79
     * @param string $className
80
     * @return static
81
     */
82
    public static function eventHasMissingInterface($className)
83
    {
84
        return self::makeNewInstance(
85
            self::EVENT_CLASS_MISSING_INTERFACE,
86
            1503873348,
87
            [$className, Event::class]
88
        );
89
    }
90
91
    /**
92
     * @param string $propertyType
93
     * @param string $identifier
94
     * @return static
95
     */
96
    public static function tagServicePropertyWrongParent($propertyType, $identifier)
97
    {
98
        return self::makeNewInstance(
99
            self::TAG_SERVICE_PROPERTY_WRONG_PARENT,
100
            1504167339,
101
            [$propertyType, $identifier, PropertyEntry::class]
102
        );
103
    }
104
105
    /**
106
     * @param string $className
107
     * @return static
108
     */
109
    public static function notificationMissingInterface($className)
110
    {
111
        return self::makeNewInstance(
112
            self::NOTIFICATION_MISSING_INTERFACE,
113
            1505821532,
114
            [$className, Notification::class]
115
        );
116
    }
117
118
    /**
119
     * @param string $notificationClassName
120
     * @param string $processorClassName
121
     * @return static
122
     */
123
    public static function notificationProcessorWrongParent($notificationClassName, $processorClassName)
124
    {
125
        return self::makeNewInstance(
126
            self::NOTIFICATION_PROCESSOR_WRONG_PARENT,
127
            1505829694,
128
            [$notificationClassName, NotificationProcessor::class, $processorClassName]
129
        );
130
    }
131
132
    /**
133
     * @param string $className
134
     * @return static
135
     */
136
    public static function notificationSettingsMissingInterface($className)
137
    {
138
        return self::makeNewInstance(
139
            self::NOTIFICATION_SETTINGS_MISSING_INTERFACE,
140
            1506245423,
141
            [$className, NotificationSettings::class]
142
        );
143
    }
144
145
    /**
146
     * @param string $className
147
     * @return static
148
     */
149
    public static function eventConfigurationFlexFormProviderMissingInterface($className)
150
    {
151
        return self::makeNewInstance(
152
            self::EVENT_CONFIGURATION_FLEX_FORM_PROVIDER_MISSING_INTERFACE,
153
            1506952217,
154
            [$className, EventFlexFormProvider::class]
155
        );
156
    }
157
158
    /**
159
     * @param string $className
160
     * @return static
161
     */
162
    public static function channelSettingsMissingInterface($className)
163
    {
164
        return self::makeNewInstance(
165
            self::CHANNEL_SETTINGS_MISSING_INTERFACE,
166
            1507409177,
167
            [$className, ChannelSettings::class]
168
        );
169
    }
170
171
    /**
172
     * @param string $className
173
     * @return static
174
     */
175
    public static function eventPropertyBuilderMissingInterface($className)
176
    {
177
        return self::makeNewInstance(
178
            self::EVENT_PROPERTY_BUILDER_MISSING_INTERFACE,
179
            1519756764,
180
            [$className, PropertyBuilder::class]
181
        );
182
    }
183
}
184