Skip to content

Commit ca4f47d

Browse files
We want join, not implode
1 parent 92c1341 commit ca4f47d

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

webapp/src/Controller/Jury/ProblemController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,7 @@ public function testcasesAction(Request $request, int $probId): Response
570570
if ($request->isMethod('POST')) {
571571
if (!empty($lockedContests)) {
572572
$this->addFlash('danger', 'Cannot edit problem / testcases, it belongs to locked contest(s) '
573-
. implode(', ', $lockedContests));
573+
. join(', ', $lockedContests));
574574
return $this->redirectToRoute('jury_problem', ['probId' => $problem->getProbid()]);
575575
}
576576
$messages = [];
@@ -788,7 +788,7 @@ public function testcasesAction(Request $request, int $probId): Response
788788
if (!empty($lockedContests)) {
789789
$this->addFlash('warning',
790790
'Problem belongs to locked contest ('
791-
. implode($lockedContests)
791+
. join($lockedContests)
792792
. ', disallowing editing.');
793793
}
794794
$data = [

webapp/src/Entity/ImmutableExecutable.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ protected function updateHash(): void
7676
$filesArray = $this->files->toArray();
7777
uasort($filesArray, fn(ExecutableFile $a, ExecutableFile $b) => strcmp($a->getFilename(), $b->getFilename()));
7878
$this->hash = md5(
79-
implode(
79+
join(
8080
array_map(
8181
fn(ExecutableFile $file) => $file->getHash() . $file->getFilename() . $file->isExecutable(),
8282
$filesArray

webapp/src/Service/ImportProblemService.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,7 @@ public function importZippedProblem(
468468
}
469469
if ($numCases > 0) {
470470
$messages['info'][] = sprintf("Added/updated %d %s testcase(s): {%s}.{in,ans}",
471-
$numCases, $type, implode(',', $testcaseNames));
471+
$numCases, $type, join(',', $testcaseNames));
472472
}
473473
}
474474

@@ -484,7 +484,7 @@ public function importZippedProblem(
484484

485485
if (!empty($removedTestcases)) {
486486
$messages['info'][] = sprintf("Removed %d testcase(s): {%s}.{in,ans}",
487-
count($removedTestcases), implode(',', $removedTestcases));
487+
count($removedTestcases), join(',', $removedTestcases));
488488
}
489489

490490
// Load the current attachments to see if we need to delete, update or insert attachments
@@ -593,7 +593,7 @@ public function importZippedProblem(
593593

594594
if (!empty($removedAttachments)) {
595595
$messages['info'][] = sprintf("Removed %d attachments(s): {%s}",
596-
count($removedAttachments), implode(',', $removedAttachments));
596+
count($removedAttachments), join(',', $removedAttachments));
597597
}
598598

599599
$this->em->wrapInTransaction(function () use ($testcases, $startRank): void {
@@ -796,15 +796,15 @@ public function importZippedProblem(
796796

797797
if ($numJurySolutions > 0) {
798798
$messages['info'][] = sprintf('Added %d jury solution(s): %s', $numJurySolutions,
799-
implode(', ', $successful_subs));
799+
join(', ', $successful_subs));
800800
}
801801
if (!empty($subs_with_unknown_lang)) {
802802
$messages['warning'][] = sprintf("Could not add jury solution(s) due to unknown language: %s",
803-
implode(', ', $subs_with_unknown_lang));
803+
join(', ', $subs_with_unknown_lang));
804804
}
805805
if (!empty($too_large_subs)) {
806806
$messages['warning'][] = sprintf("Could not add jury solution(s) because they are too large: %s",
807-
implode(', ', $too_large_subs));
807+
join(', ', $too_large_subs));
808808
}
809809
} else {
810810
$messages['warning'][] = 'No jury solutions added: problem not submittable.';

webapp/src/Twig/TwigExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ public function displayTestcaseResults(array $testcases, bool $submissionDone, b
431431
}
432432
$icon = sprintf('<span class="badge text-bg-%s badge-testcase">%s</span>', $class, $text);
433433
$results .= sprintf('<a title="%s" href="#run-%d" %s>%s</a>',
434-
implode(', ', $titleElements), $testcase->getRank(),
434+
join(', ', $titleElements), $testcase->getRank(),
435435
$isCorrect ? 'onclick="display_correctruns(true);"' : '', $icon);
436436
}
437437

0 commit comments

Comments
 (0)