DuplicateEntryException   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 64
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 21
dl 0
loc 64
rs 10
c 0
b 0
f 0
wmc 4

4 Methods

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