public static function tables() { $tables = []; foreach (glob(BRAMBLE_DIR . '/.init/.tables/*.sql') as $path) { $table = Table::parse(file_get_contents($path)); $tables[$table->name()] = $table; } return TemplateGenerator::sort($tables); }
/** * @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']); }