Passed
Push — dev ( dc6ac3...67fd32 )
by Romain
06:56
created

DuplicateEntryException::markerAlreadyDefined()   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 2
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
class DuplicateEntryException extends NotizException
20
{
21
    const DEFINITION_SOURCE_DUPLICATION = 'The definition source `%s` was already registered with the class `%s`.';
22
23
    const DEFINITION_PROCESSOR_DUPLICATION = 'The definition processor `%s` was already registered with the class `%s`.';
24
25
    const PROPERTY_ENTRY_DUPLICATION = 'The property `%s` for the event `%s` already has the entry named `%s`.';
26
27
    const TAG_SERVICE_IDENTIFIER_DUPLICATION = 'The identifier `%s` is already used by the property `%s` (trying to assign it to the property `%s`).';
28
29
    const SLOT_CONTAINER_DUPLICATION = 'A slot with the identifier `%s` was already added to the container.';
30
31
    const MARKER_ALREADY_DEFINED = 'Trying to override an existing marker named `%s` to the slot `%s`.';
32
33
    /**
34
     * @param string $identifier
35
     * @param string $className
36
     * @return static
37
     */
38
    public static function definitionSourceDuplication($identifier, $className)
39
    {
40
        return self::makeNewInstance(
41
            self::DEFINITION_SOURCE_DUPLICATION,
42
            1503849691,
43
            [$identifier, $className]
44
        );
45
    }
46
47
    /**
48
     * @param string $identifier
49
     * @param string $className
50
     * @return static
51
     */
52
    public static function definitionProcessorDuplication($identifier, $className)
53
    {
54
        return self::makeNewInstance(
55
            self::DEFINITION_PROCESSOR_DUPLICATION,
56
            1503850125,
57
            [$identifier, $className]
58
        );
59
    }
60
61
    /**
62
     * @param string $name
63
     * @param string $eventClassName
64
     * @param string $propertyType
65
     * @return static
66
     */
67
    public static function propertyEntryDuplication($name, $eventClassName, $propertyType)
68
    {
69
        return self::makeNewInstance(
70
            self::PROPERTY_ENTRY_DUPLICATION,
71
            1504104622,
72
            [$propertyType, $eventClassName, $name]
73
        );
74
    }
75
76
    /**
77
     * @param string $identifier
78
     * @param string $propertyType
79
     * @param string $assignedPropertyType
80
     * @return static
81
     */
82
    public static function tagServiceIdentifierDuplication($identifier, $propertyType, $assignedPropertyType)
83
    {
84
        return self::makeNewInstance(
85
            self::TAG_SERVICE_IDENTIFIER_DUPLICATION,
86
            1504168501,
87
            [$identifier, $propertyType, $assignedPropertyType]
88
        );
89
    }
90
91
    /**
92
     * @param string $name
93
     * @return static
94
     */
95
    public static function slotContainerDuplication($name)
96
    {
97
        return self::makeNewInstance(
98
            self::SLOT_CONTAINER_DUPLICATION,
99
            1517344431,
100
            [$name]
101
        );
102
    }
103
104
    /**
105
     * @param string $marker
106
     * @param string $slot
107
     * @return static
108
     */
109
    public static function markerAlreadyDefined($marker, $slot)
110
    {
111
        return self::makeNewInstance(
112
            self::MARKER_ALREADY_DEFINED,
113
            1517410553,
114
            [$marker, $slot]
115
        );
116
    }
117
}
118