Used to match in the back-office to check whether the assets has already been compiled
or not, if not then this will be used to merge to the assets
@return string
160688
private function getCached()
    {
        $syntax = "// Cached assets do not modify\r\nlet cache = [" . PHP_EOL;

        foreach ($this->getCachedFiles() as $file) {
            $syntax .= "'$file'," . PHP_EOL;
        }

        $syntax .= "];";

        return $syntax;
    }
800023
public function getAssetFilesConfiguration()
    {
        if (!$this->assetFilesConfiguration instanceof \AssetsBundle\AssetFile\AssetFilesConfiguration) {
            $this->setAssetFilesConfiguration(new \AssetsBundle\AssetFile\AssetFilesConfiguration());
        }
        return $this->assetFilesConfiguration;
    }
1307134
protected function getAssetsUrl()
    {
        if (!isset($this->_assetsUrl)) {
            $assetPath = dirname(__DIR__) . '/assets';
            $this->_assetsUrl = Yii::app()->assetManager->publish($assetPath, false, -1, $this->forceCopyAssets);
        }
        return $this->_assetsUrl;
    }
257586
public function getCondensed()
    {
        if ($this->version === 4) {
            return $this->value;
        }

        $addr = preg_replace('/(^|:)0+(\d)/', '\1\2', $this->getExpanded());

        if (preg_match_all('/(?:^|:)(?:0(?::|$))+/', $addr, $matches, PREG_OFFSET_CAPTURE)) {
            $max = 0;
            $pos = null;

            foreach ($matches[0] as $match) {
                if (strlen($match[0]) > $max) {
                    $max = mb_strlen($match[0]);
                    $pos = $match[1];
                }
            }

            $addr = substr_replace($addr, '::', $pos, $max);
        }

        return $addr;
    }
455840
public function minifyAssetsAction ()
    {
        $request = $this->getRequest();
        $siteID = $request->getPost('siteId');
        /** @var \MelisFront\Service\MinifyAssetsService $minifyAssets */
        $minifyAssets = $this->getServiceLocator()->get('MinifyAssets');
        $result = $minifyAssets->minifyAssets($siteID);

        $title = 'Compiling assets';

        /**
         * modify a little the result
         */
        $success = true;
        $message = '';
        if(!empty($result['results'])){
            foreach($result['results'] as $key => $val){
                if(!$val['success']){
                    $success = false;
                    $message = $val['message'];
                }
            }
        }

        return new JsonModel(array(
            'title' => $title,
            'message' => wordwrap($message, 20, "\n", true),
            'success' => $success,
        ));
    }
225623
public function compiledExists()
    {
        return $this->cached === false ? false : file_exists($this->cachePath.'/'.$this->getClassName().'.php');
    }
970268
protected function compile()
	{
		if ($this->compiled !== false)
		{
			return $this->compiled;
		}

		if ($this->isStatic())
		{
			$this->compiled = '~^'.$this->pattern.'$~';
			return $this->compiled;
		}

		$compiled = $this->pattern;
		foreach ($this->getSegments($compiled) as $segment)
		{
			$compiled = \str_replace($segment['token'], $segment['regex'], $compiled);
		}

		$this->compiled = "~^{$compiled}$~";
		return $this->compiled;
	}
363371
public function getAssetPath()
    {
        $path = $this->assetsHelper->getUrl('');

        if ($path[strlen($path) - 1] === '/') {
            $path = rtrim($path, '/');
        }

        return $path;
    }
432117
public function getMatcher()
    {
        if (null !== $this->matcher) {
            return $this->matcher;
        }

        $compiled = is_a($this->options['matcher_class'], CompiledUrlMatcher::class, true) && (UrlMatcher::class === $this->options['matcher_base_class'] || RedirectableUrlMatcher::class === $this->options['matcher_base_class']);

        if (null === $this->options['cache_dir'] || null === $this->options['matcher_cache_class']) {
            $routes = $this->getRouteCollection();
            if ($compiled) {
                $routes = (new CompiledUrlMatcherDumper($routes))->getCompiledRoutes();
            }
            $this->matcher = new $this->options['matcher_class']($routes, $this->context);
            if (method_exists($this->matcher, 'addExpressionLanguageProvider')) {
                foreach ($this->expressionLanguageProviders as $provider) {
                    $this->matcher->addExpressionLanguageProvider($provider);
                }
            }

            return $this->matcher;
        }

        $cache = $this->getConfigCacheFactory()->cache($this->options['cache_dir'].'/'.$this->options['matcher_cache_class'].'.php',
            function (ConfigCacheInterface $cache) {
                $dumper = $this->getMatcherDumperInstance();
                if (method_exists($dumper, 'addExpressionLanguageProvider')) {
                    foreach ($this->expressionLanguageProviders as $provider) {
                        $dumper->addExpressionLanguageProvider($provider);
                    }
                }

                $options = [
                    'class' => $this->options['matcher_cache_class'],
                    'base_class' => $this->options['matcher_base_class'],
                ];

                $cache->write($dumper->dump($options), $this->getRouteCollection()->getResources());
            }
        );

        if ($compiled) {
            return $this->matcher = new $this->options['matcher_class'](require $cache->getPath(), $this->context);
        }

        if (!class_exists($this->options['matcher_cache_class'], false)) {
            require_once $cache->getPath();
        }

        return $this->matcher = new $this->options['matcher_cache_class']($this->context);
    }
165403
public function assemble() {
		$scripts = [];
		
		if (! empty($this->resources)) {
			foreach ($this->resources as $resource) {
				$scripts[] = $this->renderTag($resource);
			}
		}
		
		if (! empty($this->packages)) {
			foreach ($this->packages as $package) {
				$package->assemble();
				$scripts[] = $this->renderTag($package);
			}
		}
		
		if (empty($scripts)) {
			return '';
		}
		
		return implode(PHP_EOL, $scripts);
	}
1149942
public function getAssetsUrl(){
		if($this->_assetsUrl !== null){
			return $this->_assetsUrl;
		}

		$this->_assetsUrl = Yii::$app->getAssetManager()->publish(__DIR__);
		$this->_assetsUrl = $this->_assetsUrl[1];
		return $this->_assetsUrl;
	}
696895
private function mergeRules()
    {
        $rules = static::$rules;
        $output = array();

        if (empty ($rules))
        {
            return $output;
        }

        if ($this->exists)
        {
            $merged = (isset($rules['update'])) ? array_merge_recursive($rules['save'], $rules['update']) : $rules['save'];
        } else
        {
            $merged = (isset($rules['create'])) ? array_merge_recursive($rules['save'], $rules['create']) : $rules['save'];
        }

        foreach ($merged as $field => $rules)
        {
            if (is_array($rules))
            {
                $output[$field] = implode("|", $rules);
            } else
            {
                $output[$field] = $rules;
            }
        }

        return $output;
    }
446285
protected function resolveAssets(): ?string
    {
        $module = $this->getModuleInfo();
        if (!isset($module['assets'])) {
            return null;
        }
        $directory = $this->directory() . DIRECTORY_SEPARATOR . trim($module['assets'], DIRECTORY_SEPARATOR);
        return is_dir($directory) ? realpath($directory) : null;
    }
17698
public function getAssetPaths()
    {
        $this->removeDuplicates();

        $assets = [];
        foreach ($this->assets as $type => $collection) {
            $assets[$type] = [];
            foreach ($collection as $asset) {
                $assets[$type][] = $this->getAssetEntryBuildPath($asset);
            }
        }

        return $assets;
    }
472773
private function getScriptsPlacement()
    {
        $placement = $this->getArgument('placement');
        $allowed = $this->getAllowedPlacements();

        if ($placement) {
            if (! $this->isAllowedPlacement($placement)) {
                throw new AssetException('Illegal placement: Script assets can be only placed in '.implode(', ', $allowed));
            }

            if ($this->isPlacement('head')) {
                return $placement;
            }
        }

        return 'footer';
    }
1029999
public function compile()
    {
        $compiledAssets = dirname(dirname(__DIR__)) . '/.build';

        $this->compileUi($compiledAssets);

        $finder = new Finder();
        $finder->files()
            ->ignoreVCS(true)
            ->name('*.php')
            ->name('*.yml')
            ->notName('UiTask.php')
            ->in(dirname(dirname(__DIR__)) . '/src');
        foreach ($finder as $file) {
            $this->addFile($file);
        }

        $finder = new Finder();
        $finder
            ->files()
            ->ignoreVCS(true)
            ->name('*.css')
            ->name('*.js')
            ->name('*.map')
            ->name('*.png')
            ->name('*.svg')
            ->name('*.html')
            ->name('*.otf')
            ->name('*.eot')
            ->name('*.ttf')
            ->name('*.woff')
            ->name('*.woff2')
            ->name('*.json')
            ->in($compiledAssets);
        foreach ($finder as $file) {
            /** @var SplFileInfo $file */
            $this->addFile($file, false, str_replace($compiledAssets, 'assets', $file->getRealPath()));
        }
    }
1144396
protected function cacheJsAssetFiles()
    {
        if ($this->getOptions()->isProduction()) {
            // Retrieve asset file filters manager
            $oAssetFileFiltersManager = $this->getAssetFileFiltersManager();

            // Retrieve Js asset file filter if available
            $oJsFileFilter = $oAssetFileFiltersManager->has(\AssetsBundle\AssetFile\AssetFile::ASSET_JS) ? $oAssetFileFiltersManager->get(\AssetsBundle\AssetFile\AssetFile::ASSET_JS) : null;

            // Create tmp asset file
            $oTmpAssetFile = $this->createTmpAssetFile(\AssetsBundle\AssetFile\AssetFile::ASSET_JS);

            foreach ($this->getAssetFilesConfiguration()->getAssetFiles(\AssetsBundle\AssetFile\AssetFile::ASSET_JS) as $oAssetFile) {
                $sAssetFileContent = $oJsFileFilter ? $oJsFileFilter->filterAssetFile($oAssetFile) : $oAssetFile->getAssetFileContents();
                $oTmpAssetFile->setAssetFileContents($sAssetFileContent . PHP_EOL);
            }
            if($oTmpAssetFile->getAssetFileSize()){
                return array($this->getAssetFilesCacheManager()->cacheAssetFile($oTmpAssetFile));
            }
            return array();
        }

        // Retrieve asset files cache manager
        $oAssetFilesCacheManager = $this->getAssetFilesCacheManager();
        $aAssetFiles = array();
        foreach ($this->getAssetFilesConfiguration()->getAssetFiles(\AssetsBundle\AssetFile\AssetFile::ASSET_JS) as $oAssetFile) {
            // Cache asset file if not empty
            if($oAssetFile->getAssetFileSize()){
                $aAssetFiles[] = $oAssetFilesCacheManager->cacheAssetFile($oAssetFile);
            }
        }
        return $aAssetFiles;
    }