Code Duplication    Length = 19-20 lines in 2 locations

src/allejo/stakx/Compiler.php 2 locations

@@ 464-482 (lines=19) @@
461
     *
462
     * @return string
463
     */
464
    private function buildDynamicPageViewHTML(TemplateInterface &$template, &$twigItem)
465
    {
466
        $defaultContext = [
467
            'this' => $twigItem->createJail(),
468
        ];
469
470
        $preEvent = new CompilerPreRenderDynamicPageView($twigItem);
471
        $this->eventDispatcher->dispatch(CompilerPreRenderDynamicPageView::NAME, $preEvent);
472
473
        $context = array_merge($preEvent->getCustomVariables(), $defaultContext);
474
        $output = $template
475
            ->render($context)
476
        ;
477
478
        $postEvent = new CompilerPostRenderDynamicPageView($twigItem, $output);
479
        $this->eventDispatcher->dispatch(CompilerPostRenderDynamicPageView::NAME, $postEvent);
480
481
        return $postEvent->getCompiledOutput();
482
    }
483
484
    /**
485
     * Get the compiled HTML for a static PageView.
@@ 493-512 (lines=20) @@
490
     *
491
     * @return string
492
     */
493
    private function buildStaticPageViewHTML(StaticPageView &$pageView)
494
    {
495
        $defaultContext = [
496
            'this' => $pageView->createJail(),
497
        ];
498
499
        $preEvent = new CompilerPreRenderStaticPageView($pageView);
500
        $this->eventDispatcher->dispatch(CompilerPreRenderStaticPageView::NAME, $preEvent);
501
502
        $context = array_merge($preEvent->getCustomVariables(), $defaultContext);
503
        $output = $this
504
            ->createTwigTemplate($pageView)
505
            ->render($context)
506
        ;
507
508
        $postEvent = new CompilerPostRenderStaticPageView($pageView, $output);
509
        $this->eventDispatcher->dispatch(CompilerPostRenderStaticPageView::NAME, $postEvent);
510
511
        return $postEvent->getCompiledOutput();
512
    }
513
514
    /**
515
     * Create a Twig template that just needs an array to render.