Passed
Branch new-version (84e8bd)
by Jeroen
03:20
created

VCardException::forNotAllowedPropertyParameter()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 1
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace JeroenDesloovere\VCard\Exception;
4
5
use JeroenDesloovere\VCard\Property\NodeInterface;
6
use JeroenDesloovere\VCard\Property\Parameter\PropertyParameterInterface;
7
use JeroenDesloovere\VCard\Property\PropertyInterface;
8
use JeroenDesloovere\VCard\VCard;
9
10
class VCardException extends \Exception
11
{
12
    public static function forExistingProperty(PropertyInterface $property): self
13
    {
14
        return new self(
15
            'The property "' . get_class($property) . '" you are trying to add can only be added once.'
16
        );
17
    }
18
19
    public static function forExistingPropertyParameter(PropertyParameterInterface $parameter): self
20
    {
21
        return new self(
22
            'The property parameter "' . get_class($parameter) . '" you are trying to add can only be added once.'
23
        );
24
    }
25
26
    public static function forNotAllowedNode(NodeInterface $node): self
27
    {
28
        return new self(
29
            'The node "' . get_class($node) . '" you are trying to add is not allowed. Possible values are: '
30
            . implode(', ', VCard::POSSIBLE_VALUES)
31
        );
32
    }
33
}
34