Code Duplication    Length = 19-20 lines in 2 locations

src/allejo/stakx/Compiler.php 2 locations

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