/**
  * @param PrintResultEvent $printResultEvent
  * @throws \Codeception\Exception\ModuleRequireException
  */
 public function resultPrintAfter(PrintResultEvent $printResultEvent)
 {
     if (count($this->failedIdentifiers) > 0) {
         $items = '';
         $itemTemplate = new \Text_Template($this->config['templateFolder'] . 'Item.html');
         foreach ($this->failedIdentifiers as $vars) {
             $itemTemplate->setVar($vars);
             $items .= $itemTemplate->render();
         }
         $pageTemplate = new \Text_Template($this->config['templateFolder'] . 'Page.html');
         $pageTemplate->setVar(array('items' => $items));
         $reportPath = $this->fileSystemUtil->getFailImageDirectory() . 'index.html';
         $pageTemplate->renderTo($reportPath);
         $printResultEvent->getPrinter()->write('Report has been created: ' . $reportPath . "\n");
     }
 }
 /**
  * Initialize the module after configuration has been loaded
  */
 public function _initialize()
 {
     if (!class_exists('\\Imagick')) {
         throw new ModuleException(__CLASS__, 'Required class \\Imagick could not be found!
             Please install the PHP Image Magick extension to use this module.');
     }
     $this->moduleFileSystemUtil = new RegressionFileSystem($this);
     if (self::$moduleInitTime === 0) {
         self::$moduleInitTime = time();
         if ($this->config['automaticCleanup'] === true && is_dir($this->moduleFileSystemUtil->getFailImageDirectory())) {
             // cleanup fail image directory
             FileSystem::doEmptyDir($this->moduleFileSystemUtil->getFailImageDirectory());
         }
     }
     $this->moduleFileSystemUtil->createDirectoryRecursive($this->moduleFileSystemUtil->getTempDirectory());
     $this->moduleFileSystemUtil->createDirectoryRecursive($this->moduleFileSystemUtil->getReferenceImageDirectory());
     $this->moduleFileSystemUtil->createDirectoryRecursive($this->moduleFileSystemUtil->getFailImageDirectory());
 }