Skip to content

Commit

Permalink
Fix for other code that was broken under setTerminal
Browse files Browse the repository at this point in the history
  • Loading branch information
Tiddo committed Oct 30, 2024
1 parent c17523d commit bae4ece
Showing 1 changed file with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public function onDispatch(MvcEvent $e)
->addHeaderLine('X-Served-By', getenv('SERVED_BY'));
}

$result = parent::onDispatch($e);
$$result = parent::onDispatch($e);
if ($result instanceof \Laminas\View\Model\ViewModel) {

Check failure on line 89 in module/ApiBundle/Component/Controller/ActionController/ApiController.php

View workflow job for this annotation

GitHub Actions / Lint

Undefined variable: $result
$result->setTerminal(true);
}
Expand All @@ -98,17 +98,20 @@ public function onDispatch(MvcEvent $e)
if (!$this->hasAccess()->toResourceAction(
$this->getParam('controller'),
$this->getParam('action')
)
) {
)) {

Check failure on line 101 in module/ApiBundle/Component/Controller/ActionController/ApiController.php

View workflow job for this annotation

GitHub Actions / Lint

Closing parenthesis of a multi-line IF statement must be on a new line
$error = $this->error(401, 'You do not have sufficient permissions to access this resource');
$error->setOptions($result->getOptions());
if ($result instanceof \Laminas\View\Model\ViewModel) {
$error->setOptions($result->getOptions());
}
$e->setResult($error);

return $error;
}
} else {
$error = $this->error(401, 'No key or OAuth token was provided or the token was invalid');
$error->setOptions($result->getOptions());
if ($result instanceof \Laminas\View\Model\ViewModel) {
$error->setOptions($result->getOptions());
}
$e->setResult($error);

return $error;
Expand Down

0 comments on commit bae4ece

Please sign in to comment.