Skip to content

Commit

Permalink
Codacy fix PageViewController
Browse files Browse the repository at this point in the history
  • Loading branch information
chrizzor committed Jul 15, 2024
1 parent b463076 commit a63f263
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions Classes/Controller/PageViewController.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,8 @@ public function mainAction(): void
* Add multi page navigation
* @return void
*/
protected function multipageNavigation() {
protected function multipageNavigation(): void
{
$navigationArray = [];
$navigationMeasureArray = [];
$navigateAllPageNext = [];
Expand All @@ -173,16 +174,16 @@ protected function multipageNavigation() {
// convert document page information to measure count information
$this->requestData['docMeasure'][$i] = $this->convertMeasureOrPage($document, null, $this->requestData['docPage'][$i]);

} else if ((empty($this->requestData['docPage'][$i]) || $this->requestData['docPage'][$i] === 1) && $this->requestData['docMeasure'][$i]) {
} elseif ((empty($this->requestData['docPage'][$i]) || $this->requestData['docPage'][$i] === 1) && $this->requestData['docMeasure'][$i]) {
$this->requestData['docPage'][$i] = $this->convertMeasureOrPage($document, $this->requestData['docMeasure'][$i]);
}

$navigationArray[$i]['next'] = [
'tx_dlf[docPage]['.$i.']' =>
'tx_dlf[docPage][' . $i . ']' =>
MathUtility::forceIntegerInRange((int) $this->requestData['docPage'][$i] + 1, 1, $document->numPages, 1)
];
$navigationArray[$i]['prev'] = [
'tx_dlf[docPage]['.$i.']' =>
'tx_dlf[docPage][' . $i . ']' =>
MathUtility::forceIntegerInRange((int) $this->requestData['docPage'][$i] - 1, 1, $document->numPages, 1)
];

Expand Down Expand Up @@ -220,12 +221,12 @@ protected function multipageNavigation() {

if ($document->numMeasures > 0) {
$navigationMeasureArray[$i]['next'] = [
'tx_dlf[docMeasure]['.$i.']' =>
'tx_dlf[docMeasure][' . $i . ']' =>
MathUtility::forceIntegerInRange((int) $this->requestData['docMeasure'][$i] + 1, 1, $document->numMeasures, 1)
];

$navigationMeasureArray[$i]['prev'] = [
'tx_dlf[docMeasure]['.$i.']' =>
'tx_dlf[docMeasure][' . $i . ']' =>
MathUtility::forceIntegerInRange((int) $this->requestData['docMeasure'][$i] - 1, 1, $document->numMeasures, 1)
];
}
Expand Down Expand Up @@ -259,7 +260,7 @@ public function convertMeasureOrPage($document, $measure = null, $page = null)
$measure2Page = array_column($document->musicalStructure, 'page');
if ($measure) {
$return = $measure2Page[$measure];
} else if ($page) {
} elseif ($page) {
$return = array_search($page, $measure2Page);
}

Expand Down Expand Up @@ -324,7 +325,7 @@ protected function getMeasures(int $page, $specificDoc = null, $docNumber = null
// build link for each measure
$params = [
'tx_dlf' => $this->requestData,
'tx_dlf[docMeasure]['.$docNumber.']' => $i
'tx_dlf[docMeasure][' . $docNumber . ']' => $i
];
} else {
// build link for each measure
Expand Down

0 comments on commit a63f263

Please sign in to comment.