Test Failed
Push — master ( 7b15c4...7a5412 )
by Dominik
01:48
created

createMissingNormalizer()   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 1
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Chubbyphp\Serialization;
6
7
final class SerializerLogicException 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 encoder for content-type: "%s"', $contentType));
17
    }
18
19
    /**
20
     * @param string $path
21
     * @param string $type
22
     *
23
     * @return SerializerLogicException
24
     */
25 1
    public static function createWrongDataType(string $path, string $type): self
26
    {
27 1
        return new self(sprintf('Wrong data type "%s" at path : "%s"', $type, $path));
28
    }
29
30
    /**
31
     * @param string $path
32
     *
33
     * @return self
34
     */
35 1
    public static function createMissingNormalizer(string $path): self
36
    {
37 1
        return new self(sprintf('There is no normalizer at path: "%s"', $path));
38
    }
39
40
    /**
41
     * @param string $class
42
     *
43
     * @return self
44
     */
45 1
    public static function createMissingMapping(string $class): self
46
    {
47 1
        return new self(sprintf('There is no mapping for class: "%s"', $class));
48
    }
49
50
    /**
51
     * @param string $class
52
     * @param array  $methods
53
     *
54
     * @return self
55
     */
56 1
    public static function createMissingMethod(string $class, array $methods): self
57
    {
58 1
        return new self(
59 1
            sprintf('There are no accessible method(s) "%s", within class: "%s"', implode('", "', $methods), $class)
60
        );
61
    }
62
63
    /**
64
     * @param string $class
65
     * @param string $property
66
     *
67
     * @return self
68
     */
69 1
    public static function createMissingProperty(string $class, string $property): self
70
    {
71 1
        return new self(sprintf('There is no property "%s" within class: "%s"', $property, $class));
72
    }
73
}
74