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 1414
1515namespace MultiTheftAuto \Sdk \Transformer ;
1616
17+ use MultiTheftAuto \Sdk \Exception \NotCallableResourceException ;
1718use MultiTheftAuto \Sdk \Factory \ElementFactory ;
1819
1920abstract class ElementTransformer
@@ -29,6 +30,10 @@ public static function fromServer(?string $dataFromServer): ?array
2930
3031 $ data = json_decode ($ dataFromServer );
3132
33+ if ($ data === null ) {
34+ throw new NotCallableResourceException ();
35+ }
36+
3237 foreach ($ data as &$ value ) {
3338 ElementTransformer::stringValuesToObjects ($ value );
3439 }
You can’t perform that action at this time.
0 commit comments