Skip to content

Commit

Permalink
Move json{En,De}code functions to Utils
Browse files Browse the repository at this point in the history
They don't depend on any DOMjudge internals.
  • Loading branch information
eldering committed Dec 4, 2024
1 parent 0ac65d7 commit ba5462d
Show file tree
Hide file tree
Showing 19 changed files with 64 additions and 58 deletions.
3 changes: 2 additions & 1 deletion webapp/src/Command/CallApiActionCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use App\Entity\User;
use App\Service\DOMJudgeService;
use App\Utils\Utils;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
Expand Down Expand Up @@ -114,7 +115,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
}

if ($json = $input->getOption('json')) {
$data = array_merge($data, $this->dj->jsonDecode($json));
$data = array_merge($data, Utils::jsonDecode($json));

Check warning on line 118 in webapp/src/Command/CallApiActionCommand.php

View check run for this annotation

Codecov / codecov/patch

webapp/src/Command/CallApiActionCommand.php#L118

Added line #L118 was not covered by tests
}

foreach ($input->getOption('file') as $fileItem) {
Expand Down
4 changes: 2 additions & 2 deletions webapp/src/Controller/API/ContestController.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public function addContestAction(Request $request): string
return $cid;
}
} elseif ($jsonFile) {
$data = $this->dj->jsonDecode(file_get_contents($jsonFile->getRealPath()));
$data = Utils::jsonDecode(file_get_contents($jsonFile->getRealPath()));
if ($this->importExportService->importContestData($data, $message, $cid)) {
return $cid;
}
Expand Down Expand Up @@ -870,7 +870,7 @@ public function getEventFeedAction(
$result['time'] = Utils::absTime($event->getEventtime());
}

echo $this->dj->jsonEncode($result) . "\n";
echo Utils::jsonEncode($result) . "\n";

Check warning on line 873 in webapp/src/Controller/API/ContestController.php

View check run for this annotation

Codecov / codecov/patch

webapp/src/Controller/API/ContestController.php#L873

Added line #L873 was not covered by tests
ob_flush();
flush();
$lastUpdate = Utils::now();
Expand Down
4 changes: 2 additions & 2 deletions webapp/src/Controller/API/JudgehostController.php
Original file line number Diff line number Diff line change
Expand Up @@ -734,7 +734,7 @@ public function internalErrorAction(Request $request): ?int
}
}

$disabled = $this->dj->jsonDecode($disabled);
$disabled = Utils::jsonDecode($disabled);

Check warning on line 737 in webapp/src/Controller/API/JudgehostController.php

View check run for this annotation

Codecov / codecov/patch

webapp/src/Controller/API/JudgehostController.php#L737

Added line #L737 was not covered by tests

/** @var Contest|null $contest */
$contest = null;
Expand Down Expand Up @@ -770,7 +770,7 @@ public function internalErrorAction(Request $request): ?int
->andWhere('e.disabled = :disabled')
->andWhere('e.status = :status')
->setParameter('description', $description)
->setParameter('disabled', $this->dj->jsonEncode($disabled))
->setParameter('disabled', Utils::jsonEncode($disabled))

Check warning on line 773 in webapp/src/Controller/API/JudgehostController.php

View check run for this annotation

Codecov / codecov/patch

webapp/src/Controller/API/JudgehostController.php#L773

Added line #L773 was not covered by tests
->setParameter('status', 'open')
->setMaxResults(1);

Expand Down
3 changes: 2 additions & 1 deletion webapp/src/Controller/API/LanguageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use App\Entity\ExecutableFile;
use App\Entity\ImmutableExecutable;
use App\Entity\Language;
use App\Utils\Utils;
use Doctrine\ORM\NonUniqueResultException;
use Doctrine\ORM\QueryBuilder;
use FOS\RestBundle\Controller\Annotations as Rest;
Expand Down Expand Up @@ -139,7 +140,7 @@ public function configureLanguagesAction(Request $request): Response
if (!$jsonFile) {
throw new BadRequestHttpException('No JSON file supplied.');
}
$newLanguages = $this->dj->jsonDecode(file_get_contents($jsonFile->getRealPath()));
$newLanguages = Utils::jsonDecode(file_get_contents($jsonFile->getRealPath()));

Check warning on line 143 in webapp/src/Controller/API/LanguageController.php

View check run for this annotation

Codecov / codecov/patch

webapp/src/Controller/API/LanguageController.php#L143

Added line #L143 was not covered by tests

// Disable submission for all current languages, we will enable it for all new languages below.
$curLanguages = $this->em->getRepository(Language::class)->findAll();
Expand Down
3 changes: 2 additions & 1 deletion webapp/src/Controller/API/ProblemController.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use App\Service\EventLogService;
use App\Service\ImportExportService;
use App\Service\ImportProblemService;
use App\Utils\Utils;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\NonUniqueResultException;
use Doctrine\ORM\QueryBuilder;
Expand Down Expand Up @@ -108,7 +109,7 @@ public function addProblemsAction(Request $request): array
}
$message = "Error while adding problems";
if (!empty($messages)) {
$message .= ': ' . $this->dj->jsonEncode($messages);
$message .= ': ' . Utils::jsonEncode($messages);

Check warning on line 112 in webapp/src/Controller/API/ProblemController.php

View check run for this annotation

Codecov / codecov/patch

webapp/src/Controller/API/ProblemController.php#L112

Added line #L112 was not covered by tests
}
throw new BadRequestHttpException($message);
}
Expand Down
3 changes: 2 additions & 1 deletion webapp/src/Controller/Jury/BalloonController.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use App\Service\ConfigurationService;
use App\Service\DOMJudgeService;
use App\Service\EventLogService;
use App\Utils\Utils;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\ExpressionLanguage\Expression;
Expand Down Expand Up @@ -77,7 +78,7 @@ public function indexAction(BalloonService $balloonService): Response
}

// Load preselected filters
$filters = $this->dj->jsonDecode((string)$this->dj->getCookie('domjudge_balloonsfilter') ?: '[]');
$filters = Utils::jsonDecode((string)$this->dj->getCookie('domjudge_balloonsfilter') ?: '[]');
$haveFilters = $this->dj->getCookie('domjudge_balloonsfilter') != null;
$filteredAffiliations = [];
$filteredLocations = [];
Expand Down
6 changes: 3 additions & 3 deletions webapp/src/Controller/Jury/ContestController.php
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,7 @@ public function prefetchAction(Request $request, int $contestId): Response
// TODO: dedup here?
$compareExec = $this->dj->getImmutableCompareExecutable($contestProblem);
$runExec = $this->dj->getImmutableRunExecutable($contestProblem);
$runConfig = $this->dj->jsonEncode(
$runConfig = Utils::jsonEncode(

Check warning on line 711 in webapp/src/Controller/Jury/ContestController.php

View check run for this annotation

Codecov / codecov/patch

webapp/src/Controller/Jury/ContestController.php#L711

Added line #L711 was not covered by tests
[
'hash' => $runExec->getHash(),
'combined_run_compare' => $problem->getCombinedRunCompare(),
Expand All @@ -720,7 +720,7 @@ public function prefetchAction(Request $request, int $contestId): Response
->setJudgehost($judgehost)
->setPriority(JudgeTask::PRIORITY_DEFAULT)
->setCompareScriptId($compareExec->getImmutableExecId())
->setCompareConfig($this->dj->jsonEncode(['hash' => $compareExec->getHash()]))
->setCompareConfig(Utils::jsonEncode(['hash' => $compareExec->getHash()]))

Check warning on line 723 in webapp/src/Controller/Jury/ContestController.php

View check run for this annotation

Codecov / codecov/patch

webapp/src/Controller/Jury/ContestController.php#L723

Added line #L723 was not covered by tests
->setRunScriptId($runExec->getImmutableExecId())
->setRunConfig($runConfig);
$this->em->persist($judgeTask);
Expand All @@ -741,7 +741,7 @@ public function prefetchAction(Request $request, int $contestId): Response
->setJudgehost($judgehost)
->setPriority(JudgeTask::PRIORITY_DEFAULT)
->setCompileScriptId($compileExec->getImmutableExecId())
->setCompileConfig($this->dj->jsonEncode(['hash' => $compileExec->getHash()]));
->setCompileConfig(Utils::jsonEncode(['hash' => $compileExec->getHash()]));

Check warning on line 744 in webapp/src/Controller/Jury/ContestController.php

View check run for this annotation

Codecov / codecov/patch

webapp/src/Controller/Jury/ContestController.php#L744

Added line #L744 was not covered by tests
$this->em->persist($judgeTask);
$cnt++;
}
Expand Down
2 changes: 1 addition & 1 deletion webapp/src/Controller/Jury/ExternalContestController.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public function indexAction(Request $request): Response
$this->sourceService->setSource($externalContestSource);

// Load preselected filters
$filters = $this->dj->jsonDecode((string)$this->dj->getCookie('domjudge_external_source_filter') ?: '[]');
$filters = Utils::jsonDecode((string)$this->dj->getCookie('domjudge_external_source_filter') ?: '[]');

Check warning on line 105 in webapp/src/Controller/Jury/ExternalContestController.php

View check run for this annotation

Codecov / codecov/patch

webapp/src/Controller/Jury/ExternalContestController.php#L105

Added line #L105 was not covered by tests

// Build the filter form.
$form = $this->createForm(ExternalSourceWarningsFilterType::class, $filters);
Expand Down
2 changes: 1 addition & 1 deletion webapp/src/Controller/Jury/InternalErrorController.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ public function handleAction(Request $request, ?Profiler $profiler, int $errorId
if ($request->isXmlHttpRequest()) {
$profiler?->disable();
$progressReporter = function (int $progress, string $log, ?string $message = null) {
echo $this->dj->jsonEncode(['progress' => $progress, 'log' => htmlspecialchars($log), 'message' => $message]);
echo Utils::jsonEncode(['progress' => $progress, 'log' => htmlspecialchars($log), 'message' => $message]);

Check warning on line 165 in webapp/src/Controller/Jury/InternalErrorController.php

View check run for this annotation

Codecov / codecov/patch

webapp/src/Controller/Jury/InternalErrorController.php#L165

Added line #L165 was not covered by tests
ob_flush();
flush();
};
Expand Down
3 changes: 2 additions & 1 deletion webapp/src/Controller/Jury/JuryMiscController.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use App\Service\DOMJudgeService;
use App\Service\EventLogService;
use App\Service\ScoreboardService;
use App\Utils\Utils;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\Query\Expr\Join;
use Symfony\Component\DependencyInjection\Attribute\Autowire;
Expand Down Expand Up @@ -213,7 +214,7 @@ public function refreshCacheAction(Request $request, ScoreboardService $scoreboa

if ($request->isXmlHttpRequest() && $request->isMethod('POST')) {
$progressReporter = function (int $progress, string $log, ?string $message = null) {
echo $this->dj->jsonEncode(['progress' => $progress, 'log' => htmlspecialchars($log), 'message' => $message]);
echo Utils::jsonEncode(['progress' => $progress, 'log' => htmlspecialchars($log), 'message' => $message]);

Check warning on line 217 in webapp/src/Controller/Jury/JuryMiscController.php

View check run for this annotation

Codecov / codecov/patch

webapp/src/Controller/Jury/JuryMiscController.php#L217

Added line #L217 was not covered by tests
ob_flush();
flush();
};
Expand Down
6 changes: 3 additions & 3 deletions webapp/src/Controller/Jury/RejudgingController.php
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ public function finishAction(

if ($request->isXmlHttpRequest()) {
$progressReporter = function (int $progress, string $log, ?string $message = null) {
echo $this->dj->jsonEncode(['progress' => $progress, 'log' => htmlspecialchars($log), 'message' => htmlspecialchars($message ?? '')]);
echo Utils::jsonEncode(['progress' => $progress, 'log' => htmlspecialchars($log), 'message' => htmlspecialchars($message ?? '')]);

Check warning on line 452 in webapp/src/Controller/Jury/RejudgingController.php

View check run for this annotation

Codecov / codecov/patch

webapp/src/Controller/Jury/RejudgingController.php#L452

Added line #L452 was not covered by tests
ob_flush();
flush();
};
Expand Down Expand Up @@ -537,7 +537,7 @@ public function addAction(Request $request, FormFactoryInterface $formFactory):
}
if ($isCreateRejudgingAjax) {
$progressReporter = function (int $progress, string $log, ?string $redirect = null) {
echo $this->dj->jsonEncode(['progress' => $progress, 'log' => htmlspecialchars($log), 'redirect' => $redirect]);
echo Utils::jsonEncode(['progress' => $progress, 'log' => htmlspecialchars($log), 'redirect' => $redirect]);

Check warning on line 540 in webapp/src/Controller/Jury/RejudgingController.php

View check run for this annotation

Codecov / codecov/patch

webapp/src/Controller/Jury/RejudgingController.php#L540

Added line #L540 was not covered by tests
ob_flush();
flush();
};
Expand Down Expand Up @@ -722,7 +722,7 @@ public function createAction(Request $request): Response
}

$progressReporter = function (int $progress, string $log, ?string $redirect = null) {
echo $this->dj->jsonEncode(['progress' => $progress, 'log' => htmlspecialchars($log), 'redirect' => $redirect]);
echo Utils::jsonEncode(['progress' => $progress, 'log' => htmlspecialchars($log), 'redirect' => $redirect]);

Check warning on line 725 in webapp/src/Controller/Jury/RejudgingController.php

View check run for this annotation

Codecov / codecov/patch

webapp/src/Controller/Jury/RejudgingController.php#L725

Added line #L725 was not covered by tests
ob_flush();
flush();
};
Expand Down
12 changes: 6 additions & 6 deletions webapp/src/Controller/Jury/SubmissionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ public function indexAction(
}

// Load preselected filters
$filters = $this->dj->jsonDecode((string)$this->dj->getCookie('domjudge_submissionsfilter') ?: '[]');
$filters = Utils::jsonDecode((string)$this->dj->getCookie('domjudge_submissionsfilter') ?: '[]');

$results = array_keys($this->dj->getVerdicts(['final', 'in_progress']));

Expand Down Expand Up @@ -257,7 +257,7 @@ public function viewAction(
->getQuery()
->getResult();
$timelimits = array_map(function (JudgeTask $task) {
return $this->dj->jsonDecode($task->getRunConfig())['time_limit'];
return Utils::jsonDecode($task->getRunConfig())['time_limit'];

Check warning on line 260 in webapp/src/Controller/Jury/SubmissionController.php

View check run for this annotation

Codecov / codecov/patch

webapp/src/Controller/Jury/SubmissionController.php#L260

Added line #L260 was not covered by tests
}, $judgeTasks);
}

Expand Down Expand Up @@ -626,7 +626,7 @@ public function requestFullDebug(Request $request, Judging $jid): RedirectRespon
->setJobId($jid->getJudgingid())
->setUuid($jid->getUuid())
->setRunScriptId($executable->getImmutableExecId())
->setRunConfig($this->dj->jsonEncode(['hash' => $executable->getHash()]));
->setRunConfig(Utils::jsonEncode(['hash' => $executable->getHash()]));

Check warning on line 629 in webapp/src/Controller/Jury/SubmissionController.php

View check run for this annotation

Codecov / codecov/patch

webapp/src/Controller/Jury/SubmissionController.php#L629

Added line #L629 was not covered by tests
$this->em->persist($judgeTask);
}
$this->em->flush();
Expand Down Expand Up @@ -1257,8 +1257,8 @@ public function createJudgeTasks(string $submitId): RedirectResponse
*/
private function maybeGetErrors(string $type, string $expectedConfigString, string $observedConfigString, array &$allErrors): void
{
$expectedConfig = $this->dj->jsonDecode($expectedConfigString);
$observedConfig = $this->dj->jsonDecode($observedConfigString);
$expectedConfig = Utils::jsonDecode($expectedConfigString);
$observedConfig = Utils::jsonDecode($observedConfigString);

Check warning on line 1261 in webapp/src/Controller/Jury/SubmissionController.php

View check run for this annotation

Codecov / codecov/patch

webapp/src/Controller/Jury/SubmissionController.php#L1260-L1261

Added lines #L1260 - L1261 were not covered by tests
$errors = [];
foreach (array_keys($expectedConfig) as $k) {
if (!array_key_exists($k, $observedConfig)) {
Expand All @@ -1271,7 +1271,7 @@ private function maybeGetErrors(string $type, string $expectedConfigString, stri
// Silently ignore.
} else {
$errors[] = '- ' . preg_replace('/_/', ' ', $k) . ': '
. $this->dj->jsonEncode($observedConfig[$k]) . '' . $this->dj->jsonEncode($expectedConfig[$k]);
. Utils::jsonEncode($observedConfig[$k]) . '' . Utils::jsonEncode($expectedConfig[$k]);

Check warning on line 1274 in webapp/src/Controller/Jury/SubmissionController.php

View check run for this annotation

Codecov / codecov/patch

webapp/src/Controller/Jury/SubmissionController.php#L1274

Added line #L1274 was not covered by tests
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion webapp/src/Service/ConfigurationService.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use App\Entity\Configuration;
use App\Entity\Executable;
use App\Entity\Judging;
use App\Utils\Utils;
use BackedEnum;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\NonUniqueResultException;
Expand Down Expand Up @@ -269,7 +270,7 @@ public function saveChanges(
}
if (!isset($errors[$specName])) {
if ($optionToSet->getValue() != $oldValue) {
$valJson = $dj->jsonEncode($optionToSet->getValue());
$valJson = Utils::jsonEncode($optionToSet->getValue());
$dj->auditlog('configuration', $specName, 'updated', $valJson);
if ($optionIsNew) {
$this->em->persist($optionToSet);
Expand Down
25 changes: 4 additions & 21 deletions webapp/src/Service/DOMJudgeService.php
Original file line number Diff line number Diff line change
Expand Up @@ -522,23 +522,6 @@ public function alert(string $messageType, string $description = ''): void
system(sprintf('%s %s %s &', $alert, escapeshellarg($messageType), escapeshellarg($description)));
}

/**
* Decode a JSON string with our preferred settings.
* @return mixed
*/
public function jsonDecode(string $str)
{
return json_decode($str, true, 512, JSON_THROW_ON_ERROR);
}

/**
* Encode a JSON string with our preferred settings.
*/
public function jsonEncode(mixed $data): string
{
return json_encode($data, JSON_PRESERVE_ZERO_FRACTION | JSON_UNESCAPED_SLASHES | JSON_THROW_ON_ERROR);
}

/**
* Dis- or re-enable what caused an internal error.
*
Expand Down Expand Up @@ -664,7 +647,7 @@ public function internalApiRequest(string $url, string $method = Request::METHOD
return null;
}

return $this->jsonDecode($content);
return Utils::jsonDecode($content);
}

public function getDomjudgeEtcDir(): string
Expand Down Expand Up @@ -1454,7 +1437,7 @@ public function getRunConfig(ContestProblem $problem, Submission $submission, in
}
$runExecutable = $this->getImmutableRunExecutable($problem);

return $this->jsonEncode(
return Utils::jsonEncode(
[
'time_limit' => $problem->getProblem()->getTimelimit() * $submission->getLanguage()->getTimeFactor(),
'memory_limit' => $memoryLimit,
Expand All @@ -1471,7 +1454,7 @@ public function getRunConfig(ContestProblem $problem, Submission $submission, in
public function getCompareConfig(ContestProblem $problem): string
{
$compareExecutable = $this->getImmutableCompareExecutable($problem);
return $this->jsonEncode(
return Utils::jsonEncode(
[
'script_timelimit' => $this->config->get('script_timelimit'),
'script_memory_limit' => $this->config->get('script_memory_limit'),
Expand All @@ -1486,7 +1469,7 @@ public function getCompareConfig(ContestProblem $problem): string
public function getCompileConfig(Submission $submission): string
{
$compileExecutable = $submission->getLanguage()->getCompileExecutable()->getImmutableExecutable();
return $this->jsonEncode(
return Utils::jsonEncode(
[
'script_timelimit' => $this->config->get('script_timelimit'),
'script_memory_limit' => $this->config->get('script_memory_limit'),
Expand Down
16 changes: 8 additions & 8 deletions webapp/src/Service/EventLogService.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,8 @@ public function log(
$jsonPassed = isset($json);

// Make a combined string to keep track of the data ID's
$dataidsCombined = $this->dj->jsonEncode($dataIds);
$idsCombined = $ids === null ? null : (is_array($ids) ? $this->dj->jsonEncode($ids) : $ids);
$dataidsCombined = Utils::jsonEncode($dataIds);
$idsCombined = $ids === null ? null : (is_array($ids) ? Utils::jsonEncode($ids) : $ids);

$this->logger->debug(
"EventLogService::log arguments: '%s' '%s' '%s' '%s' '%s' '%s'",
Expand Down Expand Up @@ -224,7 +224,7 @@ public function log(
}

if ($ids === [null] && $json !== null) {
$data = $this->dj->jsonDecode($json);
$data = Utils::jsonDecode($json);

Check warning on line 227 in webapp/src/Service/EventLogService.php

View check run for this annotation

Codecov / codecov/patch

webapp/src/Service/EventLogService.php#L227

Added line #L227 was not covered by tests
if (!empty($data['id'])) {
$ids = [$data['id']];
}
Expand All @@ -234,14 +234,14 @@ public function log(
$ids = [$ids];
}

$idsCombined = $this->dj->jsonEncode($ids);
$idsCombined = Utils::jsonEncode($ids);

// State is a special case, as it works without an ID
if ($type !== 'state' && count(array_filter($ids)) !== count($dataIds)) {
$this->logger->warning(
"EventLogService::log API ID not specified or inferred ".
"from data for type %s and data ID's '%s'",
[ $type, $this->dj->jsonEncode($dataIds) ]
[ $type, Utils::jsonEncode($dataIds) ]
);
return;
}
Expand Down Expand Up @@ -337,7 +337,7 @@ public function log(
$now = sprintf('%.3f', microtime(true));

if ($jsonPassed) {
$json = $this->dj->jsonDecode($json);
$json = Utils::jsonDecode($json);

Check warning on line 340 in webapp/src/Service/EventLogService.php

View check run for this annotation

Codecov / codecov/patch

webapp/src/Service/EventLogService.php#L340

Added line #L340 was not covered by tests
} elseif (!in_array($type, ['contests', 'state'])) {
// Re-index JSON so we can look up the elements by ID.
$tmp = $json;
Expand Down Expand Up @@ -557,8 +557,8 @@ protected function insertEvents(
$existingEvent = $existingEvents[$event->getEndpointid()] ?? null;
$existingData = $existingEvent === null ?
null :
$this->dj->jsonEncode($existingEvent->getContent());
$data = $this->dj->jsonEncode($event->getContent());
Utils::jsonEncode($existingEvent->getContent());
$data = Utils::jsonEncode($event->getContent());
if ($existingEvent === null || $existingData !== $data) {
// Special case for state: this is always an update event
if ($endpointType === 'state') {
Expand Down
2 changes: 1 addition & 1 deletion webapp/src/Service/ImportExportService.php
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,7 @@ public function importJson(string $type, UploadedFile $file, ?string &$message =
{
$content = file_get_contents($file->getRealPath());
try {
$data = $this->dj->jsonDecode($content);
$data = Utils::jsonDecode($content);
} catch (JsonException $e) {
// Check if we can parse it as YAML
try {
Expand Down
Loading

0 comments on commit ba5462d

Please sign in to comment.