Skip to content

Commit

Permalink
[TASK] Refactor code
Browse files Browse the repository at this point in the history
$container->getChildRecords() only used for the condition. We can remove
this, because the new getAfterContainerRecord() returns the container
itself if ce has no children. We than can check if the uids are equal.
This improvement allows to extract the $sorting from the condition so we
only have the else block.
  • Loading branch information
d-g-codappix authored and achimfritz committed Aug 6, 2024
1 parent 1132599 commit 151d7ca
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions Classes/Integrity/SortingInPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,10 @@ public function run(bool $dryRun = true, bool $enableLogging = false, ?int $pid
foreach ($recordsPerPageAndColPos as $record) {
if (in_array($record['CType'], $cTypes, true)) {
$container = $this->containerFactory->buildContainer($record['uid']);
$children = $container->getChildRecords();
if (empty($children)) {
$sorting = $record['sorting'];
} else {
$lastChild = $this->containerService->getAfterContainerRecord($container);
$sorting = $lastChild['sorting'];
$lastChild = $this->containerService->getAfterContainerRecord($container);
$sorting = $lastChild['sorting'];

if ($record['uid'] !== $lastChild['uid']) {
if ($prevChild === null || $prevContainer === null) {
$prevChild = $lastChild;
$prevContainer = $container;
Expand Down

0 comments on commit 151d7ca

Please sign in to comment.