Additional formatting for view.

@param AssetBundle[] $bundles Array of bundles to formatting.

@return AssetBundle[]
180700
protected function format(array $bundles)
    {
        // @todo remove
        foreach ($bundles as $bundle) {
            array_walk($bundle->css, function (&$file, $key, $userData) {
                $file = Html::a($file, $userData->baseUrl . '/' . $file, ['target' => '_blank']);
            }, $bundle);

            array_walk($bundle->js, function (&$file, $key, $userData) {
                $file = Html::a($file, $userData->baseUrl . '/' . $file, ['target' => '_blank']);
            }, $bundle);

            array_walk($bundle->depends, function (&$depend) {
                $depend = Html::a($depend, '#' . $depend);
            });

            $this->formatOptions($bundle->publishOptions);
            $this->formatOptions($bundle->jsOptions);
            $this->formatOptions($bundle->cssOptions);
        }

        return $bundles;
    }
1218722
public static function normalizeAssetTransformToObject($assetTransform): array
    {
        $transformArray = $assetTransform->toArray();
        $validParams = ['width', 'height', 'format', 'mode', 'position', 'interlace', 'quality'];

        $r = [];

        foreach ($validParams as $param) {
            if (isset($transformArray[$param])) {
                $r[$param] = $transformArray[$param];
            }
        }

        return $r;
    }
1074428
public static function routes($bundle)
		{
			if (static::routed($bundle)) {
				return;
			}

			$path = static::path($bundle) . 'routes.php';

			// By setting the bundle property on the router, the router knows what
			// value to replace the (:bundle) place-holder with when the bundle
			// routes are added, keeping the routes flexible.
			Router::$bundle = static::option($bundle, 'handles');

			if (!static::routed($bundle) && File::exists($path)) {
				static::$routed[] = $bundle;
				require $path;
			}
		}
48580
protected function getAssets(Composer $composer, $assetDir, array $packages)
    {
        $installationManager = $composer->getInstallationManager();
        $configPackages = $this->config->getArray('enable-packages');
        $assets = array();

        foreach ($packages as $package) {
            $filename = AssetUtil::getPath($installationManager, $this->assetManager, $package, $configPackages);

            if (null !== $filename) {
                list($packageName, $packagePath) = $this->getMockPackagePath($package, $assetDir, $filename);
                $assets[$packageName] = $packagePath;
            }
        }

        $assetsEvent = new GetAssetsEvent($assetDir, $packages, $assets);
        $composer->getEventDispatcher()->dispatch(FoxyEvents::GET_ASSETS, $assetsEvent);

        return $assetsEvent->getAssets();
    }
1194674
public function attributes($bundle = null)
    {
        $key = empty($bundle) ? '@all' : $bundle;
        if (isset($this->_attributes[$key])) {
            return $this->_attributes[$key];
        }

        $this->_attributes[$key] = [];
        $cacheKey = $this->_table->table() . '_' . $key;
        $attrs = Cache::read($cacheKey, 'eav_table_attrs');

        if (empty($attrs)) {
            $conditions = ['EavAttributes.table_alias' => $this->_table->table()];
            if (!empty($bundle)) {
                $conditions['EavAttributes.bundle'] = $bundle;
            }

            $attrs = TableRegistry::get('Eav.EavAttributes')
                ->find()
                ->where($conditions)
                ->all()
                ->toArray();

            Cache::write($cacheKey, $attrs, 'eav_table_attrs');
        }

        foreach ($attrs as $attr) {
            $this->_attributes[$key][$attr->get('name')] = $attr;
        }

        return $this->attributes($bundle);
    }
858764
public function webpackAsset($asset)
    {
        $asset_id        = $this->public_path . '/' . Compiler::getAliasId($asset);
        $full_asset_path = $this->web_dir . '/' . $asset_id;

        return [
            'js'  => file_exists($full_asset_path . '.js')
                ? $asset_id . '.js?' . filemtime($full_asset_path . '.js')
                : false,
            'css' => file_exists($full_asset_path . '.css')
                ? $asset_id . '.css?' . filemtime($full_asset_path . '.css')
                : false,
        ];
    }
307820
public function assetFiles(array $assets, array $options = []): string
    {
        $assets = $this->prepareAssets($assets);
        $options = array_replace_recursive($this->options, $options);

        $cacheKey = $this->getCacheKey($assets, $options);
        $cacheItem = $this->cache->getItem($cacheKey);
        if ($cacheItem->isHit()) {
            return $cacheItem->get();
        }

        $jsFiles = [];
        $cssFiles = [];
        foreach ($assets as $file) {
            $fileType = strtolower(pathinfo($file, PATHINFO_EXTENSION));
            if ($fileType === 'js') {
                $jsFiles[] = $file;
            }
            if ($fileType === 'css') {
                $cssFiles[] = $file;
            }
        }
        $cssContent = $this->css($cssFiles, $options);
        $jsContent = $this->js($jsFiles, $options);
        $result = $cssContent . $jsContent;

        $cacheItem->set($result);
        $this->cache->save($cacheItem);

        return $result;
    }
1015928
protected List<JoinableResourceBundle> filterBundlesToRender(List<JoinableResourceBundle> bundles) {
		List<JoinableResourceBundle> filteredBundles = new ArrayList<>();
		for (JoinableResourceBundle bundle : bundles) {
			if (!bundle.getInclusionPattern().isIncludeOnlyOnDebug()) {
				filteredBundles.add(bundle);
			}
		}
		return filteredBundles;
	}
733072
protected function getRequiredServiceBundleCodeGenerators($bundle)
    {
        return [
            $this->createServiceCodeGenerator($bundle),
            $this->createServiceInterfaceCodeGenerator($bundle),
            $this->createServiceFactoryCodeGenerator($bundle),
        ];
    }
440643
public function getBundles()
    {
        $bundles = [];
        foreach ($this->getContainer()->findTaggedServiceIds('bundle') as $id => $datas) {
            $bundles[] = $this->getContainer()->get($id);
        }

        return $bundles;
    }
316667
protected function getFeatureList($bundle)
    {
        $features = [];
        $manager =  $this->getFeatureManager();
        $modules = $this->getPackagesByBundle($bundle);

        foreach ($modules as $module_name) {
            $feature = $manager->loadPackage($module_name, true);
            $overrides = $manager->detectOverrides($feature);

            $state = $feature->getState();

            if (!empty($overrides) && ($feature->getStatus() != FeaturesManagerInterface::STATUS_NO_EXPORT)) {
                $state = FeaturesManagerInterface::STATE_OVERRIDDEN;
            }

            if ($feature->getStatus() != FeaturesManagerInterface::STATUS_NO_EXPORT) {
                $features[$feature->getMachineName()] = [
                    'name' => $feature->getName(),
                    'machine_name' => $feature->getMachineName(),
                    'bundle_name' => $feature->getBundle(),
                    'status' => $manager->statusLabel($feature->getStatus()),
                    'state' => ($state != FeaturesManagerInterface::STATE_DEFAULT) ? $manager->stateLabel($state) : '',
                ];
            }
        }

        return $features;
    }
392387
protected static function addAsseticBundle( &$content )
	{
		if( preg_match( "/    bundles:[ ]*\[.*'AimeosShopBundle'.*\]/", $content ) !== 1 )
		{
			$search = array( "/    bundles:[ ]*\[([^\]]+)\]/", "/    bundles:[ ]*\[([ ]*)\]/" );
			$replace = array( "    bundles: [$1,'AimeosShopBundle']", "    bundles: ['AimeosShopBundle']" );

			if( ( $content = preg_replace( $search, $replace, $content ) ) !== null ) {
				return true;
			}
		}

		return false;
	}
1358434
protected function generateFormView(AbstractResourceBundle $bundle)
    {
        $path = $bundle->getPath() . '/Resources/views/' . $this->model . '/_form.html.twig';

        if (!file_exists($path)) {
            $entityClass = $this->getContainer()->get('doctrine')->getAliasNamespace($this->bundle->getName()) . '\\' . $this->model;
            $metadata = $this->getEntityMetadata($entityClass);

            $this->renderFile('crud/_form.html.twig.twig',
                $bundle->getPath() . '/Resources/views/' . $this->model . '/_form.html.twig',
                array(
                    'fields'  => $this->getFieldsFromMetadata($metadata[0]),
                )
            );
        }
    }
1150327
public static function loadAll(array $bundles)
    {
        foreach ($bundles as $bundle) {
            if (!$bundle instanceof BundleInterface) {
                throw new InvalidArgumentException('Bundle must be instance of "Rad\Core\BundleInterface".');
            }

            self::load($bundle);
        }
    }
1272882
public static function process($assets)
    {
        if ($directory = self::getOutputDirectory()) {
            $relativeDirectory = self::getRelativeOutputDirectory();
            $filename = '';
            $sourceFiles = array();
            for ($i = 0; $i < count($assets); ++$i) {
                $asset = $assets[$i];
                $filename .= $asset->getAssetHashKey();
                $sourceFiles[] = $asset->getAssetURL();
            }
            $filename = sha1($filename);
            $cacheFile = $directory.'/'.$filename.'.css';
            if (!file_exists($cacheFile)) {
                $css = '';
                foreach ($assets as $asset) {
                    $contents = $asset->getAssetContents();
                    if (isset($contents)) {
                        $contents = self::changePaths($contents, $asset->getAssetURLPath(), $relativeDirectory);
                        if ($asset->assetSupportsMinification()) {
                            $contents = \CssMin::minify($contents);
                        }
                        $css .= $contents."\n\n";
                    }
                }
                @file_put_contents($cacheFile, $css);
            }

            $asset = new self();
            $asset->setAssetURL($relativeDirectory.'/'.$filename.'.css');
            $asset->setAssetPath($directory.'/'.$filename.'.css');
            $asset->setCombinedAssetSourceFiles($sourceFiles);

            return array($asset);
        }

        return $assets;
    }
925615
public function addBundle(Bundle $bundle)
    {
        foreach ($bundle as $resource) {
            if (is_string($resource)) {
                $this->addFile($resource);
            } else {
                $this->buildFromIterator($resource);
            }
        }
    }
738945
private function initBundles()
    {
        $bundleLoader = $this->getContainer()->get('bundle.loader');
        if (!$bundleLoader->isRestored() && null !== $this->getConfig()->getBundlesConfig()) {
            $bundleLoader->load($this->getConfig()->getBundlesConfig());
        }

        return $this;
    }