示例#1
0
 /**
  * Saves the image sprite and stylesheet.
  *
  * @param  Configuration  $config The Configuration instance
  * @param  ImageInterface $image  The ImageInterface instance
  * @param  string         $styles The CSS stylesheet
  * @return void
  *
  * @throws \RuntimeException If the image sprite could not be saved
  * @throws \RuntimeException If the stylesheet could not be saved
  */
 protected function save(Configuration $config, ImageInterface $image, $styles)
 {
     $this->createDirectory(array($config->getImage(), $config->getStylesheet()));
     try {
         $image->save($config->getImage(), $config->getOptions());
     } catch (\RuntimeException $e) {
         // @codeCoverageIgnoreStart
         throw new \RuntimeException(sprintf('Unable to write file "%s".', $config->getImage()));
         // @codeCoverageIgnoreEnd
     }
     if (false === @file_put_contents($config->getStylesheet(), $styles)) {
         // @codeCoverageIgnoreStart
         throw new \RuntimeException(sprintf('Unable to write file "%s".', $config->getStylesheet()));
         // @codeCoverageIgnoreEnd
     }
 }