Passed
Push — master ( d163c6...a9c836 )
by Romain
03:58
created

definitionSourceDuplication()   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 10
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
class DuplicateEntryException extends NotizException
20
{
21
    const PROPERTY_ENTRY_DUPLICATION = 'The property `%s` for the event `%s` already has the entry named `%s`.';
22
23
    const TAG_SERVICE_IDENTIFIER_DUPLICATION = 'The identifier `%s` is already used by the property `%s` (trying to assign it to the property `%s`).';
24
25
    const SLOT_CONTAINER_DUPLICATION = 'A slot with the identifier `%s` was already added to the container.';
26
27
    const MARKER_ALREADY_DEFINED = 'Trying to override an existing marker named `%s` to the slot `%s`.';
28
29
    /**
30
     * @param string $name
31
     * @param string $eventClassName
32
     * @param string $propertyType
33
     * @return self
34
     */
35
    public static function propertyEntryDuplication($name, $eventClassName, $propertyType)
36
    {
37
        return self::makeNewInstance(
38
            self::PROPERTY_ENTRY_DUPLICATION,
39
            1504104622,
40
            [$propertyType, $eventClassName, $name]
41
        );
42
    }
43
44
    /**
45
     * @param string $identifier
46
     * @param string $propertyType
47
     * @param string $assignedPropertyType
48
     * @return self
49
     */
50
    public static function tagServiceIdentifierDuplication($identifier, $propertyType, $assignedPropertyType)
51
    {
52
        return self::makeNewInstance(
53
            self::TAG_SERVICE_IDENTIFIER_DUPLICATION,
54
            1504168501,
55
            [$identifier, $propertyType, $assignedPropertyType]
56
        );
57
    }
58
59
    /**
60
     * @param string $name
61
     * @return self
62
     */
63
    public static function slotContainerDuplication($name)
64
    {
65
        return self::makeNewInstance(
66
            self::SLOT_CONTAINER_DUPLICATION,
67
            1517344431,
68
            [$name]
69
        );
70
    }
71
72
    /**
73
     * @param string $marker
74
     * @param string $slot
75
     * @return self
76
     */
77
    public static function markerAlreadyDefined($marker, $slot)
78
    {
79
        return self::makeNewInstance(
80
            self::MARKER_ALREADY_DEFINED,
81
            1517410553,
82
            [$marker, $slot]
83
        );
84
    }
85
}
86