createMissingContentType()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 1
dl 0
loc 3
ccs 0
cts 0
cp 0
crap 2
rs 10
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