DeserializerLogicException   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 9
c 0
b 0
f 0
dl 0
loc 37
ccs 6
cts 6
cp 1
rs 10
wmc 7

7 Methods

Rating   Name   Duplication   Size   Complexity  
A createMissingMethod() 0 4 1
A createConvertTypeDoesNotExists() 0 3 1
A createMissingDenormalizer() 0 3 1
A createMissingProperty() 0 3 1
A createMissingContentType() 0 3 1
A createFactoryDoesNotReturnObject() 0 3 1
A createMissingMapping() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Chubbyphp\Deserialization;
6
7
final class DeserializerLogicException extends \LogicException
8
{
9
    public static function createMissingContentType(string $contentType): self
10
    {
11
        return new self(sprintf('There is no decoder for content-type: "%s"', $contentType));
12
    }
13
14 1
    public static function createMissingDenormalizer(string $path): self
15
    {
16 1
        return new self(sprintf('There is no denormalizer at path: "%s"', $path));
17
    }
18
19
    public static function createMissingMapping(string $class): self
20
    {
21
        return new self(sprintf('There is no mapping for class: "%s"', $class));
22
    }
23
24 1
    public static function createMissingMethod(string $class, array $methods): self
25
    {
26 1
        return new self(
27
            sprintf('There are no accessible method(s) "%s", within class: "%s"', implode('", "', $methods), $class)
28
        );
29
    }
30
31
    public static function createMissingProperty(string $class, string $property): self
32
    {
33
        return new self(sprintf('There is no property "%s" within class: "%s"', $property, $class));
34 1
    }
35
36 1
    public static function createFactoryDoesNotReturnObject(string $path, string $dataType): self
37
    {
38
        return new self(sprintf('Factory does not return object, "%s" given at path: "%s"', $dataType, $path));
39
    }
40
41
    public static function createConvertTypeDoesNotExists(string $convertType): self
42
    {
43
        return new self(sprintf('Convert type "%s" is not supported', $convertType));
44
    }
45
}
46