Exemple #1
0
 /**
  * @param string $dir
  * @param bool $rebuild
  * @throws \Exception
  */
 private function __construct($dir, $rebuild)
 {
     $this->m_filters = [];
     $this->m_path = str_replace("\\", '', $dir);
     $key = 'templates_' . str_replace(['-', '/', ' '], '_', preg_replace('`[^a-zA-Z0-9_\\-/ ]+`', '', $this->m_path));
     $this->m_templates = Cache::load($key, function () use($dir) {
         return TemplateGenerator::generate($dir);
     }, $rebuild);
     $this->register('iteration', [self::class, '_filter_iteration']);
     $this->register('cycle', [self::class, '_filter_cycle']);
     $this->register('first', [self::class, '_filter_first']);
 }