public function buildLegacyKernelHandlerRest($mvcConfiguration)
    {
        $legacyRootDir = $this->legacyRootDir;
        $webrootDir = $this->webrootDir;
        $uriHelper = $this->uriHelper;
        $eventDispatcher = $this->eventDispatcher;
        $container = $this->container;
        $that = $this;

        return function () use ($legacyRootDir, $webrootDir, $container, $uriHelper, $eventDispatcher, $that) {
            if (!$that->getRestHandler()) {
                chdir($legacyRootDir);

                $legacyParameters = new ParameterBag();
                $request = $this->requestStack->getCurrentRequest();

                if ($that->getBuildEventsEnabled()) {
                    // PRE_BUILD_LEGACY_KERNEL for non request related stuff
                    $eventDispatcher->dispatch(LegacyEvents::PRE_BUILD_LEGACY_KERNEL, new PreBuildKernelEvent($legacyParameters));

                    // Pure web stuff
                    $eventDispatcher->dispatch(
                        LegacyEvents::PRE_BUILD_LEGACY_KERNEL_WEB,
                        new PreBuildKernelWebHandlerEvent($legacyParameters, $request)
                    );
                }

                $that->setRestHandler(new ezpKernelRest($legacyParameters->all(), ResponseWriter::class));
                chdir($webrootDir);
            }

            return $that->getRestHandler();
        };
    }
public function buildLegacyKernelHandlerRest($mvcConfiguration)
    {
        $legacyRootDir = $this->legacyRootDir;
        $webrootDir = $this->webrootDir;
        $uriHelper = $this->uriHelper;
        $eventDispatcher = $this->eventDispatcher;
        $container = $this->container;
        $that = $this;

        return function () use ($legacyRootDir, $webrootDir, $container, $uriHelper, $eventDispatcher, $that) {
            if (!$that->getRestHandler()) {
                chdir($legacyRootDir);

                $legacyParameters = new ParameterBag();
                $request = $this->requestStack->getCurrentRequest();

                if ($that->getBuildEventsEnabled()) {
                    // PRE_BUILD_LEGACY_KERNEL for non request related stuff
                    $eventDispatcher->dispatch(LegacyEvents::PRE_BUILD_LEGACY_KERNEL, new PreBuildKernelEvent($legacyParameters));

                    // Pure web stuff
                    $eventDispatcher->dispatch(
                        LegacyEvents::PRE_BUILD_LEGACY_KERNEL_WEB,
                        new PreBuildKernelWebHandlerEvent($legacyParameters, $request)
                    );
                }

                $that->setRestHandler(new ezpKernelRest($legacyParameters->all(), ResponseWriter::class));
                chdir($webrootDir);
            }

            return $that->getRestHandler();
        };
    }
public function buildLegacyKernelHandlerRest ( $ mvcConfiguration ) { $ legacyRootDir = $ this -> legacyRootDir ; $ webrootDir = $ this -> webrootDir ; $ uriHelper = $ this -> uriHelper ; $ eventDispatcher = $ this -> eventDispatcher ; $ container = $ this -> container ; $ that = $ this ; return function ( ) use ( $ legacyRootDir , $ webrootDir , $ container , $ uriHelper , $ eventDispatcher , $ that ) { if ( ! $ that -> getRestHandler ( ) ) { chdir ( $ legacyRootDir ) ; $ legacyParameters = new ParameterBag ( ) ; $ request = $ this -> requestStack -> getCurrentRequest ( ) ; if ( $ that -> getBuildEventsEnabled ( ) ) { // PRE_BUILD_LEGACY_KERNEL for non request related stuff $ eventDispatcher -> dispatch ( LegacyEvents :: PRE_BUILD_LEGACY_KERNEL , new PreBuildKernelEvent ( $ legacyParameters ) ) ; // Pure web stuff $ eventDispatcher -> dispatch ( LegacyEvents :: PRE_BUILD_LEGACY_KERNEL_WEB , new PreBuildKernelWebHandlerEvent ( $ legacyParameters , $ request ) ) ; } $ that -> setRestHandler ( new ezpKernelRest ( $ legacyParameters -> all ( ) , ResponseWriter :: class ) ) ; chdir ( $ webrootDir ) ; } return $ that -> getRestHandler ( ) ; } ; }
Builds the legacy kernel handler for the tree menu in admin interface.

@return \Closure a closure returning an \ezpKernelTreeMenu instance
Builds the legacy kernel handler for the tree menu in admin interface .