src/Nooku/Composer/Installer/JoomlaExtension.php
protected function _getElementFromManifest($manifest, $manifestPath)
    {
        $element = '';
        $type    = (string) $manifest->attributes()->type;

        switch($type)
        {
            case 'component':
                $name    = strtolower((string) $manifest->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($manifest->files->children()))
                {
                    foreach($manifest->files->children() as $file)
                    {
                        if ((string) $file->attributes()->$type)
                        {
                            $element = (string) $file->attributes()->$type;
                            break;
                        }
                    }
                }
                break;
            case 'file':
            case 'library':
                $element = substr($manifestPath, 0, -strlen('.xml'));
                break;
            case 'package':
                $element = preg_replace('/[^A-Z0-9_\.-]/i', '', $manifest->packagename);

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

        return $element;
    }
protected function _getElementFromManifest($manifest, $manifestPath)
    {
        $element = '';
        $type    = (string) $manifest->attributes()->type;

        switch($type)
        {
            case 'component':
                $name    = strtolower((string) $manifest->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($manifest->files->children()))
                {
                    foreach($manifest->files->children() as $file)
                    {
                        if ((string) $file->attributes()->$type)
                        {
                            $element = (string) $file->attributes()->$type;
                            break;
                        }
                    }
                }
                break;
            case 'file':
            case 'library':
                $element = substr($manifestPath, 0, -strlen('.xml'));
                break;
            case 'package':
                $element = preg_replace('/[^A-Z0-9_\.-]/i', '', $manifest->packagename);

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

        return $element;
    }
protected function _getElementFromManifest ( $ manifest , $ manifestPath ) { $ element = '' ; $ type = ( string ) $ manifest -> attributes ( ) -> type ; switch ( $ type ) { case 'component' : $ name = strtolower ( ( string ) $ manifest -> 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 ( $ manifest -> files -> children ( ) ) ) { foreach ( $ manifest -> files -> children ( ) as $ file ) { if ( ( string ) $ file -> attributes ( ) -> $ type ) { $ element = ( string ) $ file -> attributes ( ) -> $ type ; break ; } } } break ; case 'file' : case 'library' : $ element = substr ( $ manifestPath , 0 , - strlen ( '.xml' ) ) ; break ; case 'package' : $ element = preg_replace ( '/[^A-Z0-9_\.-]/i' , '' , $ manifest -> packagename ) ; if ( substr ( $ element , 0 , 4 ) != 'pkg_' ) { $ element = 'pkg_' . $ element ; } break ; case 'language' : $ element = $ manifest -> get ( 'tag' ) ; break ; case 'template' : $ name = preg_replace ( '/[^A-Z0-9_ \.-]/i' , '' , $ manifest -> name ) ; $ element = strtolower ( str_replace ( ' ' , '_' , $ name ) ) ; break ; default : break ; } return $ element ; }
Load the element name from the installation manifest.

@param $manifest
@return mixed|string
Load the element name from the installation manifest .