Hostnet\Component\Webpack\Asset\TrackedFiles::__construct PHP Method

__construct() public method

Track a set of paths
public __construct ( array $paths )
$paths array the list of directories or files to track / follow
    public function __construct(array $paths)
    {
        //Filter out the files, the Finder class can not handle files in the ->in() call.
        $files = array_filter($paths, function ($possible_file) {
            return is_file($possible_file);
        });
        //Filter out the directories to be used for searching using the Filter class.
        $dirs = array_filter($paths, function ($possible_dir) {
            return is_dir($possible_dir);
        });
        $finder = new Finder();
        //Add the given 'stand-alone-files'
        $finder->append($files);
        //Add the Directores recursively
        $finder = $finder->in($dirs);
        //Filter out non readable files
        $finder = $finder->filter(function (SplFileInfo $finder) {
            return $finder->isReadable();
        });
        //Loop through all the files and save the latest modification time.
        foreach ($finder->files() as $file) {
            /*@var $file \SplFileInfo */
            if ($this->modification_time < $file->getMTime()) {
                $this->modification_time = $file->getMTime();
            }
        }
    }