public function getDependencies(AssetTarget $target)
{
$children = [];
foreach ($target->files() as $file) {
$contents = $file->contents();
preg_match_all($this->_pattern, $contents, $matches, PREG_SET_ORDER);
if (empty($matches)) {
continue;
}
foreach ($matches as $match) {
if ($match[1] === '"') {
// Same directory include
$path = $this->_findFile($match[2], dirname($file->path()) . DIRECTORY_SEPARATOR);
} else {
// scan all paths
$path = $this->_findFile($match[2]);
}
$dep = new Local($path);
$children[] = $dep;
$newTarget = new AssetTarget('phony.js', [$dep]);
$children = array_merge($children, $this->getDependencies($newTarget));
}
}
return $children;
}