Skip to content

Commit

Permalink
ViewRenderer: Add type hints
Browse files Browse the repository at this point in the history
  • Loading branch information
nilmerg committed Feb 9, 2024
1 parent c9aa7a1 commit 429ba25
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/Compat/ViewRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,16 @@

namespace ipl\Web\Compat;

use Icinga\Web\View;
use ipl\Html\HtmlDocument;
use Zend_Controller_Action_Helper_ViewRenderer as Zf1ViewRenderer;
use Zend_Controller_Action_HelperBroker as Zf1HelperBroker;

class ViewRenderer extends Zf1ViewRenderer
{
/** @var View */
public $view;

/**
* Inject the view renderer
*/
Expand Down Expand Up @@ -41,9 +46,10 @@ public function getName()
*/
public function render($action = null, $name = null, $noController = null)
{
$view = $this->view;
/** @var HtmlDocument $document */
$document = $this->view->document;

if ($view->document->isEmpty() || $this->getRequest()->getParam('error_handler') !== null) {
if ($document->isEmpty() || $this->getRequest()->getParam('error_handler') !== null) {
parent::render($action, $name, $noController);

return;
Expand All @@ -53,7 +59,7 @@ public function render($action = null, $name = null, $noController = null)
$name = $this->getResponseSegment();
}

$this->getResponse()->appendBody($view->document->render(), $name);
$this->getResponse()->appendBody($document->render(), $name);

$this->setNoRender();
}
Expand Down

0 comments on commit 429ba25

Please sign in to comment.