InvalidClassException   A
last analyzed

Complexity

Total Complexity 10

Size/Duplication

Total Lines 151
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 51
dl 0
loc 151
rs 10
c 0
b 0
f 0
wmc 10

10 Methods

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