/** * Returns the name of an adapter class by $name. * * @param string $name * @param string $namespace * @throws Adapter\Exception * @return string */ protected static function getAdapterName($name) { $path = self::getFilePath(__NAMESPACE__ . '\\Adapter\\'); $scan = scandir($path); foreach ($scan as $node) { $file = Helper\String::factory($node)->toLower(); if ($file->startsWith($name) && $file->endsWith(".php")) { return __NAMESPACE__ . '\\Adapter\\' . str_replace(".php", "", $node); } } throw new Adapter\Exception("adapter '" . $name . "' does not exist"); }
/** * Returns the name of an adapter class by $name. * * @param string $name * @param string $namespace * @throws TeamSpeak3_Adapter_Exception * @return string */ protected static function getAdapterName($name, $namespace = "TeamSpeak3_Adapter_") { $path = self::getFilePath($namespace); $scan = scandir($path); foreach ($scan as $node) { $file = Helper\String::factory($node)->toLower(); if ($file->startsWith($name) && $file->endsWith(".php")) { return $namespace . str_replace(".php", "", $node); } } throw new Exception("adapter '" . $name . "' does not exist"); }