Skip to content

Commit 5f12e57

Browse files
committed
Make util classes not instantiable
1 parent 06bb5a6 commit 5f12e57

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

src/Utils/Input.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
1515

1616
namespace MultiTheftAuto\Sdk\Utils;
1717

18-
class Input
18+
abstract class Input
1919
{
2020
public static function get(): ?string
2121
{
2222
$input = file_get_contents('php://input');
23-
return $input?? null;
23+
return $input? $input : null;
2424
}
2525
}

src/Utils/Translator.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,15 @@
1818
use MultiTheftAuto\Sdk\Model\Element;
1919
use MultiTheftAuto\Sdk\Model\Resource;
2020

21-
class Translator
21+
abstract class Translator
2222
{
23-
public static function fromServer(string $dataFromServer): array
23+
public static function fromServer(?string $dataFromServer): ?array
2424
{
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+
}
2830
}
2931

3032
return $dataFromServer;

0 commit comments

Comments
 (0)