Set up CSS and JS asset arrays based on the base-file names
@param string $type whether 'css' or 'js'
@param array $files the list of 'css' or 'js' basefile names
556833
protected function setupAssets($type, $files = [])
    {
        $srcFiles = [];
        $minFiles = [];
        foreach ($files as $file) {
            $srcFiles[] = "{$file}.{$type}";
            $minFiles[] = "{$file}.min.{$type}";
        }
        if (empty($this->$type)) {
            //$this->$type = YII_DEBUG ? $srcFiles : $minFiles;
            $this->$type = $srcFiles;
        }
    }
387948
public function buildTag($asset, $type)
    {
        $attrs = $this->markSource ? $this->markAttr : [];

        switch ($type) {
            case self::ASSET_JS_FILE:
                return Html::script($asset, $attrs);
                break;
            case self::ASSET_JS:
                return Html::scriptCode($asset, $attrs);
                break;
            case self::ASSET_CSS_FILE:
                return Html::css($asset, $attrs);
                break;
            case self::ASSET_CSS:
                return Html::style($asset, $attrs);
                break;
        }

        return '';
    }
1261304
public function combine(array $assets, $type)
	{
		$paths = array();
		$lastmod = 0;
		foreach ($assets as $asset) {
			$paths[] = $asset['path'];
			$mod = File::lastModified($asset['path']);
			if ($mod > $lastmod) {
				$lastmod = $mod;
			}
		}
		
		$file = $this->cache_path . '/casset-' . md5(implode(',', $paths) . $lastmod) . '-' . $this->name;
		$file .= ('script' === $type) ? '.js' : '.css';
		
		$combine = false;
		if (!File::exists($file)) {
			$combine = true;
		}
		else if (File::lastModified($file) < $lastmod) {
			$combine = true;
		}
		
		if ($combine) {
			$content = '';
			
			foreach ($assets as $asset) {
				if (!File::exists($asset['path'])) {
					continue;
				}
				
				$c = File::get($asset['path']);
				
				if ($this->minify
					&& !(stripos($asset['source'], '.min')
						|| stripos($asset['source'], '-min')
					)
				) {
					switch ($type) {
						case 'style':
							$c = Compressors\Css::process($c);
							break;
							
						case 'script':
							$c = Compressors\Js::minify($c);
							break;
					}
				}
				
				$content .= "/* {$asset['source']} */\n$c\n\n";
			}
			
			File::put($file, $content);
		}
		
		return array(array(
			'path'       => $file,
			'attributes' => array(),
			'url'        => str_ireplace($this->public_path, '', $file),
		));
	}
601113
public function clear( $type = null ) 
	{
		if ( is_null( $type ) )
		{
			$this->assets = array();
		}
		else
		{
			if ( isset( $this->assets[$type] ) )
			{
				$this->assets[$type] = array();
			}
		}
	}
982270
public function javascript_files($type) {
        if ($type === 'footer') {
            $type = 'javascripts_footer';
        } else {
            $type = 'javascripts';
        }

        $js = array();
        // find out wanted parent javascripts
        $excludes = $this->resolve_excludes('parents_exclude_javascripts');
        if ($excludes !== true) {
            foreach (array_reverse($this->parent_configs) as $parent_config) { // base first, the immediate parent last
                $parent = $parent_config->name;
                if (empty($parent_config->$type)) {
                    continue;
                }
                if (!empty($excludes[$parent]) and $excludes[$parent] === true) {
                    continue;
                }
                foreach ($parent_config->$type as $javascript) {
                    if (!empty($excludes[$parent]) and is_array($excludes[$parent])
                        and in_array($javascript, $excludes[$parent])) {
                        continue;
                    }
                    $javascriptfile = "$parent_config->dir/javascript/$javascript.js";
                    if (is_readable($javascriptfile)) {
                        $js[] = $javascriptfile;
                    }
                }
            }
        }

        // current theme javascripts
        if (is_array($this->$type)) {
            foreach ($this->$type as $javascript) {
                $javascriptfile = "$this->dir/javascript/$javascript.js";
                if (is_readable($javascriptfile)) {
                    $js[] = $javascriptfile;
                }
            }
        }
        return $js;
    }
1006665
public function loadFiles($assets)
    {
        foreach ($assets as $type => $item) {
            $addMethod = 'load' . ucfirst($type);

            if (method_exists($this, $addMethod)) {
                call_user_func_array([&$this, $addMethod], [$item]);
            }
        }
    }
819978
public static function setup($byType, array $attributes)
    {
        if (0 !== preg_match('#^(' . self::$alloweds . '|select|form)$#', $type)) {
            self::$preAttrs[$byType] = $attributes;
        }
    }
926455
public function addFiles($type, $fileArray)
	{
		$method = 'add' . ucfirst($type) . "Files";

		if (method_exists($this, $method))
		{
			$this->$method($fileArray);
		}
		else
		{
			$this->say('Missing method: ' . $method);
		}

		return true;
	}
1295210
public function setFiles(array $files)
    {
        $this->files = array();
        foreach ($files as $key => $file) {
            if (!is_array($file)) {
                $file = array('content' => $file);
            }

            $file = array_merge(array(
                'content' => null,
                'mtime' => null,
            ), $file);

            $this->setFile($key, $file['content'], $file['mtime']);
        }
    }
1255815
public function setFiles($files = [])
    {
        if (!$files instanceof FileBag) {
            $files = new FileBag($files);
        }

        $this->_files = $files;
    }
1148240
protected static function _assetOptions($path, $type, $options) {
		$defaults = [
			'base' => null,
			'timestamp' => false,
			'filter' => null,
			'paths' => [],
			'suffix' => null,
			'check' => false,
			'library' => true
		];

		$base = isset($options['base']) ? rtrim($options['base'], '/') : '';
		$options += ['scope' => static::scope()];
		$name = $options['scope'];

		if ($config = static::attached($name)) {
			$base = isset($config['base']) ? '/' . $config['base'] : $base;
			$defaults = array_merge($defaults, $config);

			if (preg_match('/^((?:[a-z0-9-]+:)?\/\/)([^\/]*)/i', $base, $match)) {
				$options = array_merge($defaults, [
					'base' => rtrim($base . '/' . $defaults['prefix'], '/')
				]);
			} else {
				$host = '';

				if ($defaults['absolute']) {
					$host = $defaults['host'];

					if (is_array($host)) {
						$hash = substr(hexdec(md5($path)), 0, 10);
						$index = ((integer) $hash) % count($host);

						if (is_array($defaults['scheme'])) {
							$host = $defaults['scheme'][$index] . $host[$index];
						} else {
							$host = $defaults['scheme'] . $host[$index];
						}
					} else {
						$host = $defaults['scheme'] . $defaults['host'];
					}
					$base = trim($base, '/');
					$base = $base ? '/' . $base : '';
				}
				$options['base'] = rtrim($host . $base . '/' . $defaults['prefix'], '/');
			}
		}

		if (!$paths = static::_assets($type)) {
			$paths = static::_assets('generic');
		}
		return $options + $paths + $defaults;
	}
1357369
function setfs( $paths ) {
		if ( ! is_array($paths) )
			$paths = explode( "\n", $paths );

		$paths = array_filter( array_map( 'trim', $paths ) );

		foreach ( $paths as $path ) {
			// Allow for comments
			if ( '#' == $path[0] )
				continue;

			// Directories
			if ( '/' == $path[ strlen($path) -1 ] )
				$this->mkdir( $path );
			else // Files (with dummy content for now)
				$this->put_contents( $path, 'This is a test file' );
		}

	}
1294727
public function addIndexFile($file, $type = 'cli')
    {
        $type = strtolower($type);

        if (!in_array($type, ['cli', 'web'])) {
            throw new \InvalidArgumentException(sprintf('Index file type "%s" is invalid, must be one of: cli, web', $type));
        }

        $this->index[$type] = [$file, realpath($this->path . DIRECTORY_SEPARATOR . $file)];
    }
619884
public function setFiles($files) {
		$files = $this->parseFiles($files);
		$this->file->setAll($files);
	}
527254
public function setType($type)
	{
		if ($type === self::TYPE_CSS || $type === self::TYPE_JS)
			$this->_options['type'] = $type;
		else
			throw new Exception('Invalid type: '.$type);
	}
1210281
public function load($file, $type = null)
    {
        $path = $this->locator->locate($file);

        $content = $this->loadFile($path);

        $this->configCollection->addResource(new FileResource($path));

        // empty file
        if (null === $content) {
            return;
        }

        // imports
        $this->parseImports($content, $path);

        // parameters
        if (isset($content['parameters'])) {
            foreach ($content['parameters'] as $key => $value) {
                $this->configCollection->setParameter($key, $value);
            }
        }

        // extensions
        $this->loadFromExtensions($content);
    }
1180084
final protected function canLoadAsset($file, $type) {
        $filename = basename($file);
        if (in_array($filename, $this->loadedAssets[$type]))
            return false;

        $this->loadedAssets[$type][] = $filename;
        return true;
    }