예제 #1
0
파일: Job.php 프로젝트: cyantree/mosaic
 /** @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;
 }
예제 #2
0
파일: Mosaic.php 프로젝트: cyantree/mosaic
 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;
 }
예제 #3
0
 public static function createFromFile($path)
 {
     $config = new Configuration();
     $config->load($path);
     return $config;
 }