/** * @param Translator $translator * @param MessageCatalogueInterface[] $availableCatalogues * @param string $locale * @throws InvalidArgumentException * @return MessageCatalogueInterface|NULL */ public function compile(Translator $translator, array &$availableCatalogues, $locale) { if (empty($locale)) { throw new InvalidArgumentException("Invalid locale."); } if (isset($availableCatalogues[$locale])) { return $availableCatalogues; } $cacheKey = array($locale, $translator->getFallbackLocales()); $storage = $this->cache->getStorage(); if (!$storage instanceof Kdyby\Translation\Caching\PhpFileStorage) { if (($messages = $this->cache->load($cacheKey)) !== NULL) { $availableCatalogues[$locale] = new MessageCatalogue($locale, $messages); return $availableCatalogues; } $this->catalogueFactory->createCatalogue($translator, $availableCatalogues, $locale); $this->cache->save($cacheKey, $availableCatalogues[$locale]->all()); return $availableCatalogues; } $storage->hint = $locale; $cached = $compiled = $this->cache->load($cacheKey); if ($compiled === NULL) { $this->catalogueFactory->createCatalogue($translator, $availableCatalogues, $locale); $this->cache->save($cacheKey, $compiled = $this->compilePhpCache($translator, $availableCatalogues, $locale)); $cached = $this->cache->load($cacheKey); } $availableCatalogues[$locale] = self::load($cached['file']); return $availableCatalogues; }
protected function createGroupedSelectionInstance($table, $column) { return new GroupedSelection($this->context, $this->conventions, $table, $column, $this, $this->cache ? $this->cache->getStorage() : NULL); }
public function createSelectionInstance($table = NULL) { return new Selection($this->connection, $table ?: $this->name, $this->reflection, $this->cache ? $this->cache->getStorage() : NULL); }
/** @return NIStorage */ static function getCacheStorage() { return self::$cache->getStorage(); }