protected function retrieveBundleWebFolder()
    {
        $asset = $this->asset;
        
        $namespacesFile = $this->kernel->getRootDir() . '/../vendor/composer/autoload_namespaces.php';
        if (file_exists($namespacesFile)) {
            $map = require $namespacesFile;
            foreach ($map as $namespace => $paths) {
                if ( ! is_array($paths)) {
                    $paths = array($paths);
                }
                
                foreach($paths as $path) {
                    if (strpos($this->asset, $path) !== false) {
                        preg_match('/Bundle(.*)/', $this->asset, $matches);
                        $asset = str_replace("\\", "", $namespace) . $matches[1];
                        break;
                    }
                }
            }
        }

        preg_match('/([^@\/][\w]+Bundle)\/(Resources\/public)?\/(.*)/', $asset, $matches);
        if (!empty($matches) && count($matches) == 4) {
            return sprintf('bundles/%s/%s', preg_replace('/bundle$/', '', strtolower($matches[1])), $matches[3]);
        }

        preg_match('/[\/]?(bundles.*)/', strtolower($asset), $matches);
        if (!empty($matches)) {
            return $matches[1];
        }

        $asset = str_replace("@", "", strtolower($asset));
        $bundleDir = preg_replace('/bundle$/', '', $asset);

        return ($bundleDir !== $asset) ? 'bundles/' . $bundleDir : null;
    }
protected function retrieveBundleWebFolder()
    {
        $asset = $this->asset;
        
        $namespacesFile = $this->kernel->getRootDir() . '/../vendor/composer/autoload_namespaces.php';
        if (file_exists($namespacesFile)) {
            $map = require $namespacesFile;
            foreach ($map as $namespace => $paths) {
                if ( ! is_array($paths)) {
                    $paths = array($paths);
                }
                
                foreach($paths as $path) {
                    if (strpos($this->asset, $path) !== false) {
                        preg_match('/Bundle(.*)/', $this->asset, $matches);
                        $asset = str_replace("\\", "", $namespace) . $matches[1];
                        break;
                    }
                }
            }
        }

        preg_match('/([^@\/][\w]+Bundle)\/(Resources\/public)?\/(.*)/', $asset, $matches);
        if (!empty($matches) && count($matches) == 4) {
            return sprintf('bundles/%s/%s', preg_replace('/bundle$/', '', strtolower($matches[1])), $matches[3]);
        }

        preg_match('/[\/]?(bundles.*)/', strtolower($asset), $matches);
        if (!empty($matches)) {
            return $matches[1];
        }

        $asset = str_replace("@", "", strtolower($asset));
        $bundleDir = preg_replace('/bundle$/', '', $asset);

        return ($bundleDir !== $asset) ? 'bundles/' . $bundleDir : null;
    }
protected function retrieveBundleWebFolder ( ) { $ asset = $ this -> asset ; $ namespacesFile = $ this -> kernel -> getRootDir ( ) . '/../vendor/composer/autoload_namespaces.php' ; if ( file_exists ( $ namespacesFile ) ) { $ map = require $ namespacesFile ; foreach ( $ map as $ namespace => $ paths ) { if ( ! is_array ( $ paths ) ) { $ paths = array ( $ paths ) ; } foreach ( $ paths as $ path ) { if ( strpos ( $ this -> asset , $ path ) !== false ) { preg_match ( '/Bundle(.*)/' , $ this -> asset , $ matches ) ; $ asset = str_replace ( "\\" , "" , $ namespace ) . $ matches [ 1 ] ; break ; } } } } preg_match ( '/([^@\/][\w]+Bundle)\/(Resources\/public)?\/(.*)/' , $ asset , $ matches ) ; if ( ! empty ( $ matches ) && count ( $ matches ) == 4 ) { return sprintf ( 'bundles/%s/%s' , preg_replace ( '/bundle$/' , '' , strtolower ( $ matches [ 1 ] ) ) , $ matches [ 3 ] ) ; } preg_match ( '/[\/]?(bundles.*)/' , strtolower ( $ asset ) , $ matches ) ; if ( ! empty ( $ matches ) ) { return $ matches [ 1 ] ; } $ asset = str_replace ( "@" , "" , strtolower ( $ asset ) ) ; $ bundleDir = preg_replace ( '/bundle$/' , '' , $ asset ) ; return ( $ bundleDir !== $ asset ) ? 'bundles/' . $ bundleDir : null ; }
Retrieves the web bundle folder from the current asset

@return null|string
Retrieves the web bundle folder from the current asset