Esempio n. 1
0
 /**
  * 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);
 }
Esempio n. 2
0
    /**
     * 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);
    }
Esempio n. 3
0
 /**
  * @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);
 }
Esempio n. 4
0
 /**
  * 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;
 }