Ejemplo n.º 1
0
 public function apply()
 {
     if ($files = $this->getKitFiles()) {
         foreach ($files as $file => $path) {
             $import = new Imports($path);
             // Make a backup of the file.
             $this->writeFile($import->getSource(), $file, 'source');
             // Now store the compiled file
             $this->writeFile($import->apply(), $file, 'source');
             foreach ($import->getImports() as $key => $value) {
                 $this->imports[$key] = $value;
             }
         }
     }
     $files = array_diff_key($files, $this->imports);
     foreach ($files as $file => $path) {
         $variables = new Variables($path, TRUE);
         $variables->extract();
         $result = $variables->apply();
         $file = preg_replace('/\\.kit$/', '.html', $file);
         $path = $this->writeFile($result, $file);
         $this->exports[$file] = $path;
     }
     return $result;
 }