Transform classname to a path $foundBundle substract it to get the destination

@param Bundle $bundle

@return string
485780
protected function findBasePathForBundle($bundle)
    {
        $path        = str_replace('\\', DIRECTORY_SEPARATOR, $bundle->getNamespace());
        $search      = str_replace('\\', DIRECTORY_SEPARATOR, $bundle->getPath());
        $destination = str_replace(DIRECTORY_SEPARATOR . $path, '', $search, $c);

        if ($c !== 1) {
            throw new RuntimeException(sprintf('Can\'t find base path for bundle (path: "%s", destination: "%s").', $path, $destination));
        }

        return $destination;
    }
206451
public static function getBundleName()
    {
        $path = (new ReflectionClass(get_called_class()))->getFileName();
        $basePath = substr($path, 0, strrpos(strtolower($path), 'bundle') + 7);
        $files = glob(sprintf('%s/*Bundle.php', $basePath));
        $firstBundle = current($files);
        if ($firstBundle) {
            return pathinfo($firstBundle, PATHINFO_FILENAME);
        }

        return '';
    }
1339171
protected function getAvailableTemplates(BundleInterface $bundle)
    {
        $configs = [];
        $counter = 1;

        // Get the available sections from disc
        if (Kernel::VERSION_ID >= 40000) {
            $dir = $this->getContainer()->getParameter('kernel.project_dir').'/config/kunstmaancms/pagetemplates/';
        } else {
            $dir = $bundle->getPath().'/Resources/config/pagetemplates/';
        }

        if (file_exists($dir) && is_dir($dir)) {
            $finder = new Finder();
            $finder->files()->in($dir)->depth('== 0');
            foreach ($finder as $file) {
                $info = $this->getTemplateInfo($dir, $file->getFileName());
                if (is_array($info)) {
                    $configs[$counter++] = $info;
                }
            }
        }

        return $configs;
    }
310856
public function find($class)
    {
        $reflectionClass = new \ReflectionClass($class);

        do {
            $classNamespace = $reflectionClass->getNamespaceName();
            foreach ($this->bundles as $bundleName => $bundleClass) {
                $bundleNamespace = \substr($bundleClass, 0, \strrpos($bundleClass, '\\'));
                if (0 === \strpos($classNamespace, $bundleNamespace)) {
                    return $bundleName;
                }
            }
            $reflectionClass = $reflectionClass->getParentClass();
        } while ($reflectionClass);

        return null;
    }
841673
private function getLegacyMigrationDefinition($version, $bundle)
    {
        if (!isset($this->activeBundles[$bundle])) {
            return false;
        }

        $versionsDir = $this->activeBundles[$bundle] . '/' . $this->legacyMigrationsDir;
        $versionDefinitions = glob($versionsDir . "/$version*");

        if (!is_array($versionDefinitions)) {
            return false;
        }

        foreach ($versionDefinitions as $key => $versionDefinition) {
            if (!in_array(pathinfo($versionDefinition, PATHINFO_EXTENSION), array('php', 'yml', 'sql'))) {
                unset($versionDefinitions[$key]);
            }
        }

        if (empty($versionDefinitions)) {
            return false;
        }

        return $versionDefinitions[0];
    }
1110661
private String getStoredBundlePath(String bundleName, boolean asGzippedBundle) {
		String tempFileName;

		if (asGzippedBundle)
			tempFileName = gzipDirPath;
		else
			tempFileName = textDirPath;

		return getStoredBundlePath(tempFileName, bundleName);
	}
1283387
protected function getBundleName($path)
    {
        if (is_dir($path)) {
            $finder = new Finder();
            $bundles = $finder->files()->depth(0)->name('*Bundle.php')->in($path);
            foreach ($bundles as $bundle) {
                return basename($bundle->getFilename(), 'Bundle.php');
            }
        }

        return null;
    }
1034736
public function getJsBundlePath()
    {
        $cacheDir = $this->getJsCachePath();

        if ($this->isRelativePath($cacheDir)) {
            $cacheDir = $this->getDocRoot() . DIRECTORY_SEPARATOR . $cacheDir;
        }

        $name = $this->getName();

        if (null === $name) {
            $name = sprintf('bundle_%s', $this->getJsFileList()->getHash());
        } elseif (strpos($name, '%s') !== false) {
            $name = sprintf($name, $this->getJsFileList()->getHash());
        }

        return sprintf(
            "%s%s%s.js",
            $cacheDir,
            DIRECTORY_SEPARATOR,
            $name
        );
    }
692462
function getBundlesPaths(configuration){
	// If a bundlesPath is not provided, the paths are not needed because they are
	// already set up in steal.js
	if(!configuration.loader.bundlesPath) {
		return "";
	}
	var bundlesPath = configuration.bundlesPathURL;

	// Get the dist directory and set the paths output
	var paths = util.format('\tSystem.paths["bundles/*.css"] ="%s/*css";\n' +
													'\tSystem.paths["bundles/*"] = "%s/*.js";\n',
													bundlesPath, bundlesPath);
	return "if(!System.bundlesPath) {\n" + paths + "}\n";
}
375735
public function setBundle(\CampaignChain\CoreBundle\Entity\Bundle $bundle = null)
    {
        $this->bundle = $bundle;

        return $this;
    }
58062
protected function getSkeletonDirs(BundleInterface $bundle = null)
    {
        $baseSkeletonDirs = parent::getSkeletonDirs($bundle);
        $skeletonDirs = array();

        if (is_dir($dir = $this->getContainer()->get('kernel')->getRootdir().'/Resources/MultiUserBundleMultiUserBundle/skeleton')) {
            $skeletonDirs[] = $dir;
        }

        $reflClass = new \ReflectionClass($this);
        $dir = dirname($reflClass->getFileName());

        $skeletonDirs[] = $dir.'/../Resources/skeleton';
        $skeletonDirs[] = $dir.'/../Resources';

        return array_merge($skeletonDirs, $baseSkeletonDirs);
    }
1070110
protected function getAvailablePages(BundleInterface $bundle)
    {
        $pages = [];
        $counter = 1;

        // Get the available pages from disc
        $dir = $bundle->getPath().'/Entity/Pages/';
        if (file_exists($dir) && is_dir($dir)) {
            $finder = new Finder();
            $finder->files()->in($dir)->depth('== 0');
            foreach ($finder as $file) {
                $pages[$counter++] = [
                    'name' => substr($file->getFileName(), 0, strlen($file->getFileName()) - 4),
                    'path' => $file->getPathName(),
                ];
            }
        }

        return $pages;
    }
1358434
protected function generateFormView(AbstractResourceBundle $bundle)
    {
        $path = $bundle->getPath() . '/Resources/views/' . $this->model . '/_form.html.twig';

        if (!file_exists($path)) {
            $entityClass = $this->getContainer()->get('doctrine')->getAliasNamespace($this->bundle->getName()) . '\\' . $this->model;
            $metadata = $this->getEntityMetadata($entityClass);

            $this->renderFile('crud/_form.html.twig.twig',
                $bundle->getPath() . '/Resources/views/' . $this->model . '/_form.html.twig',
                array(
                    'fields'  => $this->getFieldsFromMetadata($metadata[0]),
                )
            );
        }
    }
909388
protected function writeBundleFile($bundlePath, $data)
    {
        $dir = dirname($bundlePath);

        if (!file_exists($dir)) {
            mkdir($dir, 0777, true);
        }

        if (false === file_put_contents($bundlePath, $data, LOCK_EX)) {
            // @codeCoverageIgnoreStart
            throw new \RuntimeException('Cannot write cache file to "' . $bundlePath . '"');
            // @codeCoverageIgnoreEnd
        }

        return filemtime($bundlePath);
    }
1296158
public static String get(Bundle bundle) {
    String applicationPath = ApplicationPath.get(bundle);
    if (applicationPath == null) {
      return null;
    }
    if (!hasHalDocs(bundle)) {
      return null;
    }
    return get(applicationPath);
  }
135738
private function getAdminServiceId($bundleName, $adminClassBasename)
    {
        $prefix = substr($bundleName, -6) == 'Bundle' ? substr($bundleName, 0, -6) : $bundleName;
        $suffix = substr($adminClassBasename, -5) == 'Admin' ? substr($adminClassBasename, 0, -5) : $adminClassBasename;
        $suffix = str_replace('\\', '.', $suffix);

        return Container::underscore(sprintf(
            '%s.admin.%s',
            $prefix,
            $suffix
        ));
    }
128218
protected String getBundleJarPath() throws MalformedURLException {
        Path path = PROPERTIES.getAllureHome().resolve("app/allure-bundle.jar").toAbsolutePath();
        if (Files.notExists(path)) {
            throw new AllureCommandException(String.format("Bundle not found by path <%s>", path));
        }
        return path.toUri().toURL().toString();
    }