Lookup in priority.

- <Bundle>/Resources/SymfonyIdAdminBundle/skeleton
- app/Resources/SymfonyIdAdminBundle/skeleton
- <ThisBundleDir>/Resources/skeleton
- <ThisBundleDir/Resources

@param BundleInterface|null $bundle

@return array
502007
protected function getSkeletonDirs(BundleInterface $bundle = null)
    {
        $skeletonDirs = array();

        if (isset($bundle) && is_dir($dir = $bundle->getPath().'/Resources/SymfonyIdAdminBundle/skeleton')) {
            $skeletonDirs[] = $dir;
        }

        /** @var KernelInterface $kernel */
        $kernel = $this->getContainer()->get('kernel');
        if (is_dir($dir = $kernel->getRootDir().'/Resources/SymfonyIdAdminBundle/skeleton')) {
            $skeletonDirs[] = $dir;
        }

        $reflClass = new \ReflectionObject($this);
        $skeletonDirs[] = dirname($reflClass->getFileName()).'/../Resources/skeleton';
        $skeletonDirs[] = dirname($reflClass->getFileName()).'/../Resources';

        return $skeletonDirs;
    }
844700
public function addBundle($bundle)
    {
        if (!isset($this->_bundles)) {
            $this->_bundles = [];
        }
        if (!is_array($bundle)) {
            $bundle = [];
        }
        if (!isset($bundle['class'])) {
            $bundle['class'] = $this->bundleClass;
        }
        $bundle = Yii::createObject($bundle);
        $this->_bundles[$bundle->id] = $bundle;

        return $bundle;
    }
1193829
protected function getSchemasFromBundle(BundleInterface $bundle)
    {
        $finalSchemas = array();

        if (is_dir($dir = $bundle->getPath() . '/Resources/config')) {
            $finder = new Finder();
            $schemas = $finder->files()->name('*schema.xml')->followLinks()->in($dir);

            if (iterator_count($schemas)) {
                foreach ($schemas as $schema) {
                    $logicalName = $this->transformToLogicalName($schema, $bundle);
                    $finalSchema = new \SplFileInfo($this->getFileLocator()->locate($logicalName));

                    $finalSchemas[(string)$finalSchema] = array($bundle, $finalSchema);
                }
            }
        }

        return $finalSchemas;
    }
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);
  }
375735
public function setBundle(\CampaignChain\CoreBundle\Entity\Bundle $bundle = null)
    {
        $this->bundle = $bundle;

        return $this;
    }
1195785
public function getResourcePaths()
    {
        $paths = [];

        foreach ($this->bundles as $name => $class) {
            if (null !== ($path = $this->getResourcePathFromBundle($this->appRoot, $name, $class))) {
                $paths[] = $path;
            }
        }

        if (is_readable($file = $this->appRoot . '/app/Resources/contao/config/' . $this->fileName)) {
            $paths[] = $file;
        }

        if (is_readable($file = $this->appRoot . '/system/config/' . $this->fileName)) {
            $paths[] = $file;
        }

        return $paths;
    }
254110
private function selectBundle(array $bundles)
    {
        $packageNames = array_map(function(Bundle $bundle) {
            return $bundle->getName();
        }, $bundles);

        $selectedName = $this->io->choice(
            'Please select the package, where you want to place the Migration file',
            $packageNames,
            $this->getContainer()->getParameter('campaignchain_update.diff_package')
        );

        $this->io->text('You have selected: '.$selectedName);

        $selectedBundle = null;

        foreach ($bundles as $bundle) {
            if ($bundle->getName() != $selectedName) {
                continue;
            }

            $selectedBundle = $bundle;
            break;
        }

        return $selectedBundle;
    }
742359
protected function getSourceStandards(PackageInterface $package)
    {
        $basePath = $this->getInstallPath($package);

        return $this->findStandards($basePath);
    }
873598
public static function loadBundle(&$bundle)
    {
        if (sizeof($bundle->content) == 0) {
            return;
        }
        
        // check for cached, preloaded bundle
        $bundleCache = Cache::getInstance('MEMCACHE', 'APC', 'FILE_ENCODED');
        $bundleCachePath = "xqbundle/{$bundle->bundleId}";
        
        if (!DEBUG && ($bundleCache->available() && $bundleCache->hasCached($bundleCachePath))) {
            $bundle = $bundleCache->getCached($bundleCachePath);
            return;
        }
        
        // preload
        $bundle->lastModified = null;
        $bundle->files = array();
        
        $fileNames = array();
        foreach ($bundle->content as $file) {
            $preloaded = self::getBundleFileDetails($bundle, $file);
            
            $bundle->files[] = $preloaded;
            $fileNames[] = $preloaded->path;
        }
        
        $bundle->contentType = self::getBundleContentType($bundle);
        $bundle->tag = md5($bundle->lastModified . $bundle->bundleId . implode('-', $fileNames));
        
        $bundle->output = self::getBundleContent($bundle);
        
        if (!DEBUG && $bundleCache->available()) {
            $bundleCache->cache($bundleCachePath, $bundle);
        }
    }
414852
private JoinableResourceBundle getBundleFromName(String bundleName, List<JoinableResourceBundle> bundles) {

		JoinableResourceBundle bundle = null;
		List<String> names = new ArrayList<>();
		names.add(bundleName);
		List<JoinableResourceBundle> result = getBundlesFromName(names, bundles);
		if (!result.isEmpty()) {
			bundle = result.get(0);
		}
		return bundle;
	}
369137
private Set<String> getResourcePaths(List<JoinableResourceBundle> bundles) {

		Set<String> resourcePaths = new HashSet<>();

		for (JoinableResourceBundle bundle : bundles) {
			for (BundlePath bundlePath : bundle.getItemPathList()) {
				resourcePaths.add(bundlePath.getPath());
			}
		}

		return resourcePaths;
	}
1229359
public static function option($bundle, $option, $default = null)
	{
		$bundle = static::get($bundle);

		if (is_null($bundle))
		{
			return value($default);
		}

		return array_get($bundle, $option, $default);
	}
511294
public function findClasses($bundles, $directory = '', $type = '')
    {
        $finder = Finder::create()->files()->name('*.php')->sortByName()->ignoreUnreadableDirs();
        $found  = false;

        foreach ($bundles as $bundle) {
            $path = rtrim($bundle->getPath(), DIRECTORY_SEPARATOR);

            if (true === empty($directory)) {
                $found = true;
                $finder->in($path);
                continue;
            }

            if (false === is_array($directory)) {
                $directory = [$directory];
            }

            foreach ($directory as $dir) {
                $pathname = sprintf('%s%s%s', $path, DIRECTORY_SEPARATOR, trim($dir, DIRECTORY_SEPARATOR));
                if (true === is_dir($pathname)) {
                    $found = true;
                    $finder->in($pathname);
                }
            }
        }

        if (false === $found) {
            return [];
        }

        $files = [];
        foreach ($finder as $file) {
            $files[] = $file->getPathname();
        }

        $classes = [];
        foreach ($files as $file) {
            foreach ($bundles as $bundle) {
                if (null !== $class = $this->getClassFromFileAndBundle($file, $bundle)) {
                    $classes[] = $class;
                    continue;
                }
            }
        }

        $classes = array_filter($classes, function ($e) {
            return class_exists($e);
        });

        if (false === empty($type)) {
            if (false === (class_exists($type) || interface_exists($type))) {
                throw new \InvalidArgumentException(sprintf('Class or interface "%s" unknown', $type));
            }
            $classes = array_filter($classes, function ($e) use ($type) {
                return is_subclass_of($e, $type);
            });
        }

        return $classes;
    }
323943
public function getKeyIndex($bundle, $projectId = null)
    {
        $url = sprintf($this->url_plan['get_key_index'], $projectId ?: $this->project_id, $bundle);

        return $this->callService($url);
    }
1116202
protected function Modules($bundle)
    {
        $modules = PathUtil::BackendModules($bundle);
        $result = array();
        foreach ($modules as $module)
        {
            $instance = ClassFinder::CreateBackendModule(ClassFinder::CalcModuleType($bundle, $module));
            if ($instance instanceof BackendModule)
            {
                $result[] = $module;
            }
        }
        return $result;
    }
1104847
private function findAlternative(string $nonExistentBundleName): ?string
    {
        $bundleNames = array_map(function (BundleInterface $b) {
            return $b->getName();
        }, $this->kernel->getBundles());

        $alternative = null;
        $shortest = null;
        foreach ($bundleNames as $bundleName) {
            // if there's a partial match, return it immediately
            if (false !== strpos($bundleName, $nonExistentBundleName)) {
                return $bundleName;
            }

            $lev = levenshtein($nonExistentBundleName, $bundleName);
            if ($lev <= \strlen($nonExistentBundleName) / 3 && (null === $alternative || $lev < $shortest)) {
                $alternative = $bundleName;
                $shortest = $lev;
            }
        }

        return $alternative;
    }
24251
public function getDescriptorByName(string $bundleName): ?Descriptor
    {
        if (!$this->isEmpty()) {
            /** @var Descriptor $descriptor */
            foreach ($this as $rootNamespace => $descriptor) {
                $name = $descriptor->getName();

                if ($bundleName === $name) {
                    return $descriptor;
                }
            }
        }

        return null;
    }