Passed
Push — master ( 9be19c...5278ee )
by Dominik
01:54
created

createMissingProperty()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 2
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Chubbyphp\Deserialization;
6
7
final class DeserializerLogicException extends \LogicException
8
{
9
    /**
10
     * @param string $contentType
11
     *
12
     * @return self
13
     */
14 1
    public static function createMissingContentType(string $contentType): self
15
    {
16 1
        return new self(sprintf('There is no decoder for content-type: %s', $contentType));
17
    }
18
19
    /**
20
     * @param string $class
21
     *
22
     * @return self
23
     */
24 1
    public static function createMissingMapping(string $class): self
25
    {
26 1
        return new self(sprintf('There is no mapping for class: %s', $class));
27
    }
28
29
    /**
30
     * @param string $class
31
     * @param array  $methods
32
     *
33
     * @return self
34
     */
35 1
    public static function createMissingMethod(string $class, array $methods): self
36
    {
37 1
        return new self(
38 1
            sprintf('Class %s does not contain an accessable method(s) %s', $class, implode(', ', $methods))
39
        );
40
    }
41
42
    /**
43
     * @param string $class
44
     * @param string $property
45
     *
46
     * @return self
47
     */
48 1
    public static function createMissingProperty(string $class, string $property): self
49
    {
50 1
        return new self(sprintf('Class %s does not contain property %s', $class, $property));
51
    }
52
}
53