/** * Parse theme json file * * @param array $info * @return ThemeInfoInterface * @throws ThemeInfoAttributeException */ private function parseThemeInfo(array $info) { $themeInfo = new ThemeInfo(); $required = ['name', 'author', 'namespace']; foreach ($required as $key) { if (!array_key_exists($key, $info)) { throw new ThemeInfoAttributeException($key); } } $themeInfo->setName($info['name']); $themeInfo->setAuthor($info['author']); $themeInfo->setNamespace(strtolower($info['namespace'])); if (isset($info['description'])) { $themeInfo->setDescription($info['description']); } if (isset($info['version'])) { $themeInfo->setVersion($info['version']); } if (isset($info['parent'])) { $themeInfo->setParent($info['parent']); } $themeInfo->setPath($this->findPath($info['namespace'])); return $themeInfo; }