/** * Returns all classcontents classnames * * @return string[] An array that contains all classcontents classnames */ public function getAllClassContentClassnames() { if (null === $this->contentClassnames) { $cacheId = md5('all_classcontents_classnames_' . $this->app->getContext() . '_' . $this->app->getEnvironment()); if (!$this->app->isDebugMode() && false !== ($value = $this->cache->load($cacheId))) { $this->contentClassnames = json_decode($value, true); } else { $this->contentClassnames = [AbstractClassContent::CLASSCONTENT_BASE_NAMESPACE . 'ContentSet']; foreach ($this->app->getClassContentDir() as $directory) { $this->contentClassnames = array_merge($this->contentClassnames, CategoryManager::getClassContentClassnamesFromDir($directory)); } $this->cache->save($cacheId, json_encode($this->contentClassnames)); } } return $this->contentClassnames; }
/** * CategoryManager's constructor. * * @param ApplicationInterface $application application from where we will extract classcontent's categories */ public function __construct(ApplicationInterface $application) { $this->categories = []; $this->options = ['thumbnail_url_pattern' => $application->getRouting()->getUrlByRouteName('bb.classcontent_thumbnail', ['filename' => '%s.' . $application->getContainer()->getParameter('classcontent_thumbnail.extension')])]; $this->loadCategoriesFromClassContentDirectories($application->getClassContentDir()); }