Jarves\Controller\Admin\BackendController::loadTypescriptModules PHP Метод

loadTypescriptModules() публичный Метод

This is a try to increase initial loading performance, but I wasn't lucky.
public loadTypescriptModules ( ) : string
Результат string CCS
    public function loadTypescriptModules()
    {
        $newestMTime = 0;
        $jsContent = '';
        foreach ($this->jarves->getConfigs() as $bundleConfig) {
            $path = $bundleConfig->getBundleClass()->getPath();
            $assetInfos = $bundleConfig->getAdminPreloadTypescriptModulesInfo();
            foreach ($assetInfos as $assetInfo) {
                $localPath = $this->jarves->resolveInternalPublicPath($assetInfo->getPath());
                $mtime = filemtime($localPath);
                $newestMTime = max($newestMTime, $mtime);
                $content = file_get_contents($localPath);
                $moduleName = sprintf('./bundles/%s/%s', $bundleConfig->getName(), Tools::getRelativePath($localPath, $path . '/Resources/public/'));
                $jsContent .= "\n/* ts file {$moduleName} */\ndeclare module \"{$moduleName}\" {\n{$content}\n};\n";
            }
        }
        $ifModifiedSince = $this->pageStack->getRequest()->headers->get('If-Modified-Since');
        if (isset($ifModifiedSince) && strtotime($ifModifiedSince) == $newestMTime) {
            // Client's cache IS current, so we just respond '304 Not Modified'.
            $response = new Response();
            $response->setStatusCode(304);
            $response->headers->set('Last-Modified', gmdate('D, d M Y H:i:s', $newestMTime) . ' GMT');
            return $response;
        }
        $expires = 60 * 60 * 24 * 14;
        //2 weeks
        $response = new Response();
        $response->headers->set('Content-Type', 'application/javascript');
        $response->headers->set('Pragma', 'public');
        $response->headers->set('Cache-Control', 'max-age=' . $expires);
        $response->headers->set('Expires', gmdate('D, d M Y H:i:s', time() + $expires) . ' GMT');
        //        $content = implode($files);
        $response->setContent($jsContent);
        return $response;
    }