/** @return Spritesheet */ public function createSpritesheet() { $s = new Spritesheet(); $s->name = $this->configuration->getString('name'); $this->countSpritesheets++; if ($this->countSpritesheets > 1) { $s->name .= '_' . $this->countSpritesheets; } $this->spritesheets[] = $s; return $s; }
private function processConfigurationTemplates($node) { if (!isset($node->templates)) { return $node; } $nodeCopy = Tools::deepCloneObject($node); $templates = Tools::singleOrMultipleValuesToArray($node->templates); foreach ($templates as $template) { $templateData = null; if (preg_match('!\\.yml$!', $template)) { $templateData = Configuration::createFromFile($this->getPath($template))->configuration; } else { $subConfig = $this->configuration->getSubConfiguration('templates'); if ($subConfig->has($template)) { $templateData = $subConfig->getNode($template); } else { $templateFile = $this->getApplicationPath('templates/' . $template . '.yml'); $templateData = Configuration::createFromFile($templateFile)->configuration; } } if ($templateData) { $this->processConfigurationTemplates($templateData); Tools::extendObject($node, $templateData); } } Tools::extendObject($node, $nodeCopy); return $node; }
public static function createFromFile($path) { $config = new Configuration(); $config->load($path); return $config; }