File tree Expand file tree Collapse file tree 2 files changed +9
-7
lines changed Expand file tree Collapse file tree 2 files changed +9
-7
lines changed Original file line number Diff line number Diff line change 15
15
16
16
namespace MultiTheftAuto \Sdk \Utils ;
17
17
18
- class Input
18
+ abstract class Input
19
19
{
20
20
public static function get (): ?string
21
21
{
22
22
$ input = file_get_contents ('php://input ' );
23
- return $ input ?? null ;
23
+ return $ input ? $ input : null ;
24
24
}
25
25
}
Original file line number Diff line number Diff line change 18
18
use MultiTheftAuto \Sdk \Model \Element ;
19
19
use MultiTheftAuto \Sdk \Model \Resource ;
20
20
21
- class Translator
21
+ abstract class Translator
22
22
{
23
- public static function fromServer (string $ dataFromServer ): array
23
+ public static function fromServer (? string $ dataFromServer ): ? array
24
24
{
25
- $ dataFromServer = json_decode ($ dataFromServer , true );
26
- foreach ($ dataFromServer as &$ value ) {
27
- Translator::stringValuesToObjects ($ value );
25
+ if (!empty ($ dataFromServer )) {
26
+ $ dataFromServer = json_decode ($ dataFromServer , true );
27
+ foreach ($ dataFromServer as &$ value ) {
28
+ Translator::stringValuesToObjects ($ value );
29
+ }
28
30
}
29
31
30
32
return $ dataFromServer ;
You can’t perform that action at this time.
0 commit comments