25 private $fileNameResolver;
50 private $preProcessors;
55 private $postProcessors;
75 private $parentPackages;
115 private $packageDefaultValues = [
139 array $preProcessors = [],
140 array $postProcessors = []
142 $this->packagePool = $packagePool;
143 $this->fileNameResolver = $fileNameResolver;
145 $this->theme = $theme;
146 $this->locale = $locale;
148 $this->preProcessors = $preProcessors;
149 $this->postProcessors = $postProcessors;
165 return $this->parent;
181 return $this->locale;
203 return $this->isVirtual;
212 return isset($this->params[
$name]) ? $this->params[
$name] :
null;
233 return $this->packagePool->getThemeModel($this->
getArea(), $this->
getTheme());
244 return isset($this->files[$fileId]) ? $this->files[$fileId] :
false;
258 $this->files[$file->
getFileId()] = $file;
260 $deployedFilePath = $this->
getPath() .
'/' 277 $this->map[$fileId] = [
300 public function getFilesByType(
$type)
304 foreach ($this->
getFiles() as $fileId => $file) {
305 if (!$file->getFileName()) {
308 if ($file->getExtension() ==
$type) {
309 $files[$fileId] = $file;
323 unset($this->files[$fileId]);
334 public function aggregate(
Package $parentPackage =
null)
337 foreach ($inheritedFiles as $fileId => $file) {
339 if (!$this->
getFile($fileId)) {
341 $file->setPackage($this);
344 if ($parentPackage) {
356 $this->parent = $parent;
384 $this->state = $state;
397 while ($theme = $theme->getParentTheme()) {
413 return array_merge($parentMap, $map);
425 $map = array_merge($map, $parentPackage->getMap());
440 if (
$type ===
null) {
441 $files = array_merge($files, $parentPackage->getFiles());
443 $files = array_merge($files, $parentPackage->getFilesByType(
$type));
456 if ($this->parentPackages ===
null) {
457 $this->parentPackages = [];
459 $this->collectParentPaths(
469 foreach (array_reverse($parentPaths) as
$path) {
470 if ($package = $this->packagePool->getPackage(
$path)) {
471 $this->parentPackages[
$path] = $package;
476 return $this->parentPackages;
484 return $this->preProcessors;
492 return $this->postProcessors;
506 private function collectParentPaths(
515 $result[] = $area .
'/' . $theme .
'/' . $locale;
518 if ($locale != $this->packageDefaultValues[
'locale']) {
519 $result[] = $area .
'/' . $theme .
'/' . $this->packageDefaultValues[
'locale'];
523 if ($themeModel->getParentTheme()) {
524 $this->collectParentPaths(
527 $themeModel->getParentTheme()->getThemePath(),
530 $themeModel->getParentTheme()
533 $this->collectParentPaths(
536 $this->packageDefaultValues[
'theme'],
542 if ($area != $this->packageDefaultValues[
'area']) {
543 $this->collectParentPaths(
545 $this->packageDefaultValues[
'area'],
getParentFiles($type=null)
__construct(PackagePool $packagePool, FileNameResolver $fileNameResolver, $area, $theme, $locale, $isVirtual=false, array $preProcessors=[], array $postProcessors=[])
setDeployedFilePath($name)
addFile(PackageFile $file)
addFileToMap(PackageFile $file)
if(!isset($_GET['name'])) $name