/** * Create an asset object, bridging this class and the Asset classes * @param string * @param string $type The type of the asset * @param string $id_path Either the ID string or the path of the asset * @param binary $site_name The site name * * @return mixed The asset object * @throw Exception if the asset cannot be retrieved */ public function getAsset($type, $id_path, $site_name = NULL) { if (!in_array($type, c\T::getTypeArray())) { throw new e\NoSuchTypeException(S_SPAN . "The type {$type} does not exist." . E_SPAN); } $class_name = c\T::$type_class_name_map[$type]; // get class name $class_name = a\Asset::NAME_SPACE . "\\" . $class_name; try { return new $class_name($this, $this->createId($type, $id_path, $site_name)); } catch (\Exception $e) { if (self::DEBUG && self::DUMP) { u\DebugUtility::out($e->getMessage()); } throw $e; } }