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

DeserializerLogicException   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 0
dl 0
loc 46
ccs 9
cts 9
cp 1
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A createMissingContentType() 0 4 1
A createMissingMapping() 0 4 1
A createMissingMethod() 0 6 1
A createMissingProperty() 0 4 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