本文整理汇总了PHP中Assetic\Asset\AssetCollection::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP AssetCollection::__construct方法的具体用法?PHP AssetCollection::__construct怎么用?PHP AssetCollection::__construct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Assetic\Asset\AssetCollection
的用法示例。
在下文中一共展示了AssetCollection::__construct方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Constructor.
*
* @param string|array $globs A single glob path or array of paths
* @param array $filters An array of filters
* @param string $root The root directory
* @param array $vars
* @param bool $recursive Should the glob search recursively
*/
public function __construct($globs, $filters = array(), $root = null, array $vars = array(), $recursive = false)
{
$this->globs = (array) $globs;
$this->initialized = false;
$this->recursive = $recursive;
parent::__construct(array(), $filters, $root, $vars);
}
示例2: __construct
/**
* Constructor.
*
* @param string|array $globs A single glob path or array of paths
* @param array $filters An array of filters
* @param string $baseDir A base directory to use for determining each source URL
*
* @throws InvalidArgumentException If the base directory doesn't exist
*/
public function __construct($globs, $filters = array(), $baseDir = null)
{
$this->globs = (array) $globs;
if (null !== $baseDir && $this->baseDir = realpath($baseDir)) {
$this->baseDir .= DIRECTORY_SEPARATOR;
}
$this->initialized = false;
parent::__construct(array(), $filters);
}
示例3: __construct
/**
* @param array $assets Array item is string or AssetInterface (AssetCollection also implements AssetInterface)
* @param FilterInterface[] $filters Filters that will be applied to this collection. (item can by also FilterCollection, it implements FilterInterface)
* @param NULL|string $sourceRoot Base directory for assets
* @param NULL|string $name Collection name
* @throws Exceptions\DirectoryNotFoundException
*/
public function __construct($assets = array(), $filters = array(), $sourceRoot = NULL, $name = NULL)
{
$this->setName($name);
// Validate source root if is set
if ($sourceRoot !== NULL) {
if (!file_exists($sourceRoot)) {
throw new DirectoryNotFoundException("SourceRoot directory \"{$sourceRoot}\" not found.");
} else {
if (!is_dir($sourceRoot)) {
throw new DirectoryNotFoundException("SourceRoot path \"{$sourceRoot}\" is not directory.");
} else {
$sourceRoot = realpath($sourceRoot);
}
}
}
parent::__construct(array(), $filters, $sourceRoot);
$this->addAssets($assets);
}
示例4: __construct
/**
* Creates the asset.
*
* You can pass asset variables that occur in the glob. You can later set
* the variables by calling {@link setValues()}.
*
* @param ResourceRepository $repo The resource repository.
* @param string $glob The glob.
* @param array $vars The asset variables.
*/
public function __construct(ResourceRepository $repo, $glob, array $vars = array())
{
parent::__construct(array(), array(), null, $vars);
$this->repo = $repo;
$this->glob = $glob;
}