public static function getNameFromManifest($installPath)
    {
        $manifest = self::getPackageManifest($installPath);

        if ($manifest === false) {
            return false;
        }

        $xml = simplexml_load_file($manifest);

        if (!($xml instanceof \SimpleXMLElement)) {
            return false;
        }

        $element = false;
        $type    = (string) $xml->attributes()->type;

        switch($type)
        {
            case 'component':
                $name    = strtolower((string) $xml->name);
                $element = preg_replace('/[^A-Z0-9_\.-]/i', '', $name);

                if (substr($element, 0, 4) != 'com_') {
                    $element = 'com_'.$element;
                }
                break;
            case 'module':
            case 'plugin':
                if(count($xml->files->children()))
                {
                    foreach($xml->files->children() as $file)
                    {
                        if ((string) $file->attributes()->$type)
                        {
                            $element = (string) $file->attributes()->$type;
                            break;
                        }
                    }
                }
                break;
            case 'file':
            case 'library':
                $filename = basename($manifest);
                $element  = substr($filename, 0, -strlen('.xml'));
                break;
            case 'package':
                $element = preg_replace('/[^A-Z0-9_\.-]/i', '', $xml->packagename);

                if (substr($element, 0, 4) != 'pkg_') {
                    $element = 'pkg_'.$element;
                }
                break;
            case 'language':
                $element = (string) $xml->tag;
                break;
            case 'template':
                $name    = preg_replace('/[^A-Z0-9_ \.-]/i', '', $xml->name);
                $element = strtolower(str_replace(' ', '_', $name));
                break;
            default:
                break;
        }

        return $element;
    }