public function buildLegacyKernel($legacyKernelHandler)
    {
        $legacyRootDir = $this->legacyRootDir;
        $webrootDir = $this->webrootDir;
        $eventDispatcher = $this->eventDispatcher;
        $logger = $this->logger;
        $that = $this;

        return static function () use ($legacyKernelHandler, $legacyRootDir, $webrootDir, $eventDispatcher, $logger, $that) {
            if (LegacyKernel::hasInstance()) {
                return LegacyKernel::instance();
            }

            if ($legacyKernelHandler instanceof \Closure) {
                $legacyKernelHandler = $legacyKernelHandler();
            }
            $legacyKernel = new LegacyKernel($legacyKernelHandler, $legacyRootDir, $webrootDir, $logger);

            if ($that->getBuildEventsEnabled()) {
                $eventDispatcher->dispatch(
                    LegacyEvents::POST_BUILD_LEGACY_KERNEL,
                    new PostBuildKernelEvent($legacyKernel, $legacyKernelHandler)
                );
            }

            return $legacyKernel;
        };
    }
public function buildLegacyKernel($legacyKernelHandler)
    {
        $legacyRootDir = $this->legacyRootDir;
        $webrootDir = $this->webrootDir;
        $eventDispatcher = $this->eventDispatcher;
        $logger = $this->logger;
        $that = $this;

        return static function () use ($legacyKernelHandler, $legacyRootDir, $webrootDir, $eventDispatcher, $logger, $that) {
            if (LegacyKernel::hasInstance()) {
                return LegacyKernel::instance();
            }

            if ($legacyKernelHandler instanceof \Closure) {
                $legacyKernelHandler = $legacyKernelHandler();
            }
            $legacyKernel = new LegacyKernel($legacyKernelHandler, $legacyRootDir, $webrootDir, $logger);

            if ($that->getBuildEventsEnabled()) {
                $eventDispatcher->dispatch(
                    LegacyEvents::POST_BUILD_LEGACY_KERNEL,
                    new PostBuildKernelEvent($legacyKernel, $legacyKernelHandler)
                );
            }

            return $legacyKernel;
        };
    }
public function buildLegacyKernel ( $ legacyKernelHandler ) { $ legacyRootDir = $ this -> legacyRootDir ; $ webrootDir = $ this -> webrootDir ; $ eventDispatcher = $ this -> eventDispatcher ; $ logger = $ this -> logger ; $ that = $ this ; return static function ( ) use ( $ legacyKernelHandler , $ legacyRootDir , $ webrootDir , $ eventDispatcher , $ logger , $ that ) { if ( LegacyKernel :: hasInstance ( ) ) { return LegacyKernel :: instance ( ) ; } if ( $ legacyKernelHandler instanceof \ Closure ) { $ legacyKernelHandler = $ legacyKernelHandler ( ) ; } $ legacyKernel = new LegacyKernel ( $ legacyKernelHandler , $ legacyRootDir , $ webrootDir , $ logger ) ; if ( $ that -> getBuildEventsEnabled ( ) ) { $ eventDispatcher -> dispatch ( LegacyEvents :: POST_BUILD_LEGACY_KERNEL , new PostBuildKernelEvent ( $ legacyKernel , $ legacyKernelHandler ) ) ; } return $ legacyKernel ; } ; }
Builds up the legacy kernel and encapsulates it inside a closure, allowing lazy loading.

@param \ezpKernelHandler|\Closure A kernel handler instance or a closure returning a kernel handler instance

@return \Closure
Builds up the legacy kernel and encapsulates it inside a closure allowing lazy loading .