File tree Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ /*****************************************************************************
4
+ *
5
+ * PROJECT: MTA PHP SDK
6
+ * LICENSE: See LICENSE in the top level directory
7
+ * FILE: NotCallableResourceException.php
8
+ *
9
+ * Multi Theft Auto is available from http://www.multitheftauto.com/
10
+ *
11
+ *****************************************************************************/
12
+
13
+ declare (strict_types=1 );
14
+
15
+ namespace MultiTheftAuto \Sdk \Exception ;
16
+
17
+ class NotCallableResourceException extends MessageException
18
+ {
19
+ protected const EXCEPTION_MESSAGE = 'There was a problem with the request. Ensure that the resource handling the call is running. ' ;
20
+ }
Original file line number Diff line number Diff line change 14
14
15
15
namespace MultiTheftAuto \Sdk \Transformer ;
16
16
17
+ use MultiTheftAuto \Sdk \Exception \NotCallableResourceException ;
17
18
use MultiTheftAuto \Sdk \Factory \ElementFactory ;
18
19
19
20
abstract class ElementTransformer
@@ -29,6 +30,10 @@ public static function fromServer(?string $dataFromServer): ?array
29
30
30
31
$ data = json_decode ($ dataFromServer );
31
32
33
+ if ($ data === null ) {
34
+ throw new NotCallableResourceException ();
35
+ }
36
+
32
37
foreach ($ data as &$ value ) {
33
38
ElementTransformer::stringValuesToObjects ($ value );
34
39
}
You can’t perform that action at this time.
0 commit comments