/** * @inheritdoc */ public function compile(IView $view) { $obStartLevel = ob_get_level(); ob_start(); extract($view->getVars()); try { if (eval('?>' . $view->getContents()) === false) { throw new ViewCompilerException("Invalid PHP in view"); } } catch (Exception $ex) { $this->handleException($ex, $obStartLevel); } catch (Throwable $ex) { $this->handleException($ex, $obStartLevel); } return ob_get_clean(); }