public static function loadSkinSpecification($path) { $config_path = $path . DIRECTORY_SEPARATOR . 'skin.json'; $config = array(); if (Filesystem::pathExists($config_path)) { $config = Filesystem::readFile($config_path); $config = json_decode($config, true); if (!is_array($config)) { throw new Exception("Skin configuration file '{$config_path}' is not a valid JSON file."); } $type = idx($config, 'type', self::TYPE_BASIC); } else { $type = self::TYPE_BASIC; } $spec = new PhameSkinSpecification(); $spec->setRootDirectory($path); $spec->setConfig($config); switch ($type) { case self::TYPE_BASIC: $spec->setSkinClass('PhameBasicTemplateBlogSkin'); break; case self::TYPE_ADVANCED: $spec->setSkinClass($config['class']); $spec->addPhutilLibrary($path . DIRECTORY_SEPARATOR . 'src'); break; default: throw new Exception('Unknown skin type!'); } $spec->setType($type); return $spec; }