Skip to content

Commit

Permalink
[REFACTOR] Extract $GLOBALS access to method
Browse files Browse the repository at this point in the history
  • Loading branch information
vertexvaar committed Nov 17, 2023
1 parent 672df38 commit 309bd7e
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions Classes/Controller/RecordController.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,12 @@ public function injectPageRenderer(PageRenderer $pageRenderer): void

public function initializeIndexAction(): void
{
/** @var BackendUserAuthentication $BE_USER */
$BE_USER = $GLOBALS['BE_USER'];
$data = $BE_USER->getModuleData('tx_in2publishcore_m1') ?? ['pageRecursionLimit' => 1];
$backendUser = $this->getBackendUser();
$data = $backendUser->getModuleData('tx_in2publishcore_m1') ?? ['pageRecursionLimit' => 1];
if ($this->request->hasArgument('pageRecursionLimit')) {
$pageRecursionLimit = (int)$this->request->getArgument('pageRecursionLimit');
$data['pageRecursionLimit'] = $pageRecursionLimit;
$BE_USER->pushModuleData('tx_in2publishcore_m1', $data);
$backendUser->pushModuleData('tx_in2publishcore_m1', $data);
} else {
$this->request = $this->request->withArgument('pageRecursionLimit', $data['pageRecursionLimit'] ?? 1);
}
Expand Down Expand Up @@ -235,4 +234,9 @@ protected function addFlashMessagesAndRedirectToIndex(): ResponseInterface

return $this->redirect('index', 'Record');
}

public function getBackendUser(): BackendUserAuthentication
{
return $GLOBALS['BE_USER'];
}
}

0 comments on commit 309bd7e

Please sign in to comment.