9
9
* Feel free to edit as you please, and have fun.
10
10
*
11
11
* @author Marc Morera <[email protected] >
12
- * @author PuntMig Technologies
13
12
*/
14
13
15
14
declare (strict_types=1 );
@@ -34,25 +33,47 @@ public static function getTransportableHTTPError(): int
34
33
/**
35
34
* Items representation format not valid.
36
35
*
37
- * @param mixed $itemsBeforeHydration
36
+ * @param mixed $itemBeforeHydration
38
37
*
39
38
* @return InvalidFormatException
40
39
*/
41
- public static function itemsRepresentationNotValid ( $ itemsBeforeHydration ): self
40
+ public static function itemRepresentationNotValid ( $ itemBeforeHydration ): self
42
41
{
43
- return new static (sprintf ( 'Items representation not valid. Expecting Item array serialized but found malformed data ' ) );
42
+ return new static ('Items representation not valid. Expecting Item array serialized but found malformed data ' );
44
43
}
45
44
46
45
/**
47
46
* Items UUID representation format not valid.
48
47
*
49
- * @param mixed $itemsUUIDBeforeHydration
48
+ * @param mixed $itemUUIDBeforeHydration
50
49
*
51
50
* @return InvalidFormatException
52
51
*/
53
- public static function itemsUUIDRepresentationNotValid ( $ itemsUUIDBeforeHydration ): self
52
+ public static function itemUUIDRepresentationNotValid ( $ itemUUIDBeforeHydration ): self
54
53
{
55
- return new static (sprintf ('Items UUID representation not valid. Expecting UUID array serialized but found malformed data ' ));
54
+ return new static ('Item UUID representation not valid. Expecting UUID array serialized but found malformed data ' );
55
+ }
56
+
57
+ /**
58
+ * Create Composed UUID bad format.
59
+ *
60
+ * @param string $composedUUID
61
+ *
62
+ * @return InvalidFormatException
63
+ */
64
+ public static function composedItemUUIDNotValid ($ composedUUID ): self
65
+ {
66
+ return new static ('A composed UUID should always follow this format: {id}~{type}. ' );
67
+ }
68
+
69
+ /**
70
+ * Create Query sorted by distance without coordinate.
71
+ *
72
+ * @return InvalidFormatException
73
+ */
74
+ public static function querySortedByDistanceWithoutCoordinate (): self
75
+ {
76
+ return new static ('In order to be able to sort by coordinates, you need to create a Query by using Query::createLocated() instead of Query::create() ' );
56
77
}
57
78
58
79
/**
@@ -64,7 +85,17 @@ public static function itemsUUIDRepresentationNotValid($itemsUUIDBeforeHydration
64
85
*/
65
86
public static function queryFormatNotValid ($ queryBeforeHydration ): self
66
87
{
67
- return new static (sprintf ('Query Format not valid. Expecting a Query serialized but found malformed data ' ));
88
+ return new static ('Query Format not valid. Expecting a Query serialized but found malformed data ' );
89
+ }
90
+
91
+ /**
92
+ * Coordinate format not valid.
93
+ *
94
+ * @return InvalidFormatException
95
+ */
96
+ public static function coordinateFormatNotValid (): self
97
+ {
98
+ return new static ('A Coordinate should always contain a lat (Latitude) and a lon (Longitude) ' );
68
99
}
69
100
70
101
/**
@@ -76,7 +107,7 @@ public static function queryFormatNotValid($queryBeforeHydration): self
76
107
*/
77
108
public static function configFormatNotValid ($ configBeforeHydration ): self
78
109
{
79
- return new static (sprintf ( 'Config Format not valid. Expecting a Config serialized but found malformed data ' ) );
110
+ return new static ('Config Format not valid. Expecting a Config serialized but found malformed data ' );
80
111
}
81
112
82
113
/**
@@ -88,7 +119,7 @@ public static function configFormatNotValid($configBeforeHydration): self
88
119
*/
89
120
public static function tokenFormatNotValid ($ tokenBeforeHydration ): self
90
121
{
91
- return new static (sprintf ( 'Token Format not valid. Expecting a Token serialized but found malformed data ' ) );
122
+ return new static ('Token Format not valid. Expecting a Token serialized but found malformed data ' );
92
123
}
93
124
94
125
/**
@@ -100,7 +131,7 @@ public static function tokenFormatNotValid($tokenBeforeHydration): self
100
131
*/
101
132
public static function campaignFormatNotValid ($ campaignBeforeHydration ): self
102
133
{
103
- return new static (sprintf ( 'Campaign Format not valid. Expecting a Campaign serialized but found malformed data ' ) );
134
+ return new static ('Campaign Format not valid. Expecting a Campaign serialized but found malformed data ' );
104
135
}
105
136
106
137
/**
@@ -112,7 +143,7 @@ public static function campaignFormatNotValid($campaignBeforeHydration): self
112
143
*/
113
144
public static function changesFormatNotValid ($ changesBeforeHydration ): self
114
145
{
115
- return new static (sprintf ( 'Changes Format not valid. Expecting a Changes serialized but found malformed data ' ) );
146
+ return new static ('Changes Format not valid. Expecting a Changes serialized but found malformed data ' );
116
147
}
117
148
118
149
/**
@@ -124,7 +155,7 @@ public static function changesFormatNotValid($changesBeforeHydration): self
124
155
*/
125
156
public static function boostClauseFormatNotValid ($ boostClauseBeforeHydration ): self
126
157
{
127
- return new static (sprintf ( 'Boost clause Format not valid. Expecting a Boost clause serialized but found malformed data ' ) );
158
+ return new static ('Boost clause Format not valid. Expecting a Boost clause serialized but found malformed data ' );
128
159
}
129
160
130
161
/**
@@ -136,6 +167,18 @@ public static function boostClauseFormatNotValid($boostClauseBeforeHydration): s
136
167
*/
137
168
public static function tokenUUIDFormatNotValid ($ tokenUUIDBeforeHydration ): self
138
169
{
139
- return new static (sprintf ('Token UUID Format not valid. Expecting a TokenUUID serialized but found malformed data ' ));
170
+ return new static ('Token UUID Format not valid. Expecting a TokenUUID serialized but found malformed data ' );
171
+ }
172
+
173
+ /**
174
+ * User format not valid.
175
+ *
176
+ * @param mixed $userBeforeHydration
177
+ *
178
+ * @return InvalidFormatException
179
+ */
180
+ public static function userFormatNotValid ($ userBeforeHydration ): self
181
+ {
182
+ return new static ('User Format not valid. Expecting a User serialized but found malformed data ' );
140
183
}
141
184
}
0 commit comments