|
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 $path |
|
21
|
|
|
* |
|
22
|
|
|
* @return self |
|
23
|
|
|
*/ |
|
24
|
1 |
|
public static function createMissingDenormalizer(string $path): self |
|
25
|
|
|
{ |
|
26
|
1 |
|
return new self(sprintf('There is no denormalizer at path: "%s"', $path)); |
|
27
|
|
|
} |
|
28
|
|
|
|
|
29
|
|
|
/** |
|
30
|
|
|
* @param string $class |
|
31
|
|
|
* |
|
32
|
|
|
* @return self |
|
33
|
|
|
*/ |
|
34
|
1 |
|
public static function createMissingMapping(string $class): self |
|
35
|
|
|
{ |
|
36
|
1 |
|
return new self(sprintf('There is no mapping for class: "%s"', $class)); |
|
37
|
|
|
} |
|
38
|
|
|
|
|
39
|
|
|
/** |
|
40
|
|
|
* @param string $class |
|
41
|
|
|
* @param array $methods |
|
42
|
|
|
* |
|
43
|
|
|
* @return self |
|
44
|
|
|
*/ |
|
45
|
1 |
|
public static function createMissingMethod(string $class, array $methods): self |
|
46
|
|
|
{ |
|
47
|
1 |
|
return new self( |
|
48
|
1 |
|
sprintf('There are no accessible method(s) "%s", within class: "%s"', implode('", "', $methods), $class) |
|
49
|
|
|
); |
|
50
|
|
|
} |
|
51
|
|
|
|
|
52
|
|
|
/** |
|
53
|
|
|
* @param string $class |
|
54
|
|
|
* @param string $property |
|
55
|
|
|
* |
|
56
|
|
|
* @return self |
|
57
|
|
|
*/ |
|
58
|
1 |
|
public static function createMissingProperty(string $class, string $property): self |
|
59
|
|
|
{ |
|
60
|
1 |
|
return new self(sprintf('There is no property "%s" within class: "%s"', $property, $class)); |
|
61
|
|
|
} |
|
62
|
|
|
|
|
63
|
|
|
/** |
|
64
|
|
|
* @param string $path |
|
65
|
|
|
* @param string $dataType |
|
66
|
|
|
* |
|
67
|
|
|
* @return self |
|
68
|
|
|
*/ |
|
69
|
1 |
|
public static function createFactoryDoesNotReturnObject(string $path, string $dataType): self |
|
70
|
|
|
{ |
|
71
|
1 |
|
return new self(sprintf('Factory does not return object, "%s" given at path: "%s"', $dataType, $path)); |
|
72
|
|
|
} |
|
73
|
|
|
|
|
74
|
|
|
/** |
|
75
|
|
|
* @param string $convertType |
|
76
|
|
|
* |
|
77
|
|
|
* @return self |
|
78
|
|
|
*/ |
|
79
|
1 |
|
public static function createConvertTypeDoesNotExists(string $convertType): self |
|
80
|
|
|
{ |
|
81
|
1 |
|
return new self(sprintf('Convert type "%s" is not supported', $convertType)); |
|
82
|
|
|
} |
|
83
|
|
|
} |
|
84
|
|
|
|