コード例 #1
0
ファイル: Processor.php プロジェクト: jmaurice/colour-schemes
 /**
  * Render a pattern and theme pair.
  *
  * @param  Raincolor\Containers\Pattern $pattern
  * @param  Raincolor\Containers\Pattern $theme
  * @return void
  */
 protected function render($pattern, $theme)
 {
     // Get template array from pattern.
     $templates = $pattern->get('templates');
     foreach ($templates as $template) {
         // Get the path to the pattern.
         $path = dirname($pattern->get('path'));
         // Load the template file from disk.
         $source = $this->file->load($path . '/' . $template->get('file'));
         // Create a new presenter.
         $presenter = new Presenter($source, $theme);
         // Get the resulting colour scheme.
         $scheme = $presenter->present();
         // Build the file output path for the scheme.
         $output = $this->buildOutputPath($pattern, $template, $theme);
         // Write the file to disk.
         $this->file->write($output, $scheme);
         // Update progress.
         $this->progress->advance();
     }
 }
コード例 #2
0
ファイル: Container.php プロジェクト: jmaurice/colour-schemes
 /**
  * Load container data from JSON file.
  *
  * @param  string $path
  * @return void
  */
 public function fromFile($path)
 {
     $file = new File();
     $this->setData($file->loadJson($path));
 }