Collects all bundles

@param  array $kernels
@return array
171121
public function getBundlesForKernels(array $kernels)
    {
        $bundles = array();
        foreach ($kernels as $name => $environments) {
            $environments = (array) $environments;
            foreach ($environments as $environment) {
                $kernel = $this->createKernel($name, $environment);
                $registeredBundles = array();
                foreach ($kernel->registerBundles() as $bundle) {
                    $registeredBundles[] = get_class($bundle);
                }
                $bundles = array_merge($bundles, $registeredBundles);
            }
        }

        return $bundles;
    }
923668
private function getNamespaceAutoComplete(Kernel $kernel)
    {
        $ret = array();
        foreach ($kernel->getBundles() as $k => $v) {
            $ret[] = $this->fixNamespace($v->getNamespace());
        }

        return $ret;
    }
1309103
public static List<BundleModel> bundles(BundleContext context) {
        List<BundleModel> bundles = new ArrayList<>();
        for (Bundle bundle : context.getBundles()) {
            bundles.add(new BundleModel(bundle));
        }
        return bundles;
    }
1015928
protected List<JoinableResourceBundle> filterBundlesToRender(List<JoinableResourceBundle> bundles) {
		List<JoinableResourceBundle> filteredBundles = new ArrayList<>();
		for (JoinableResourceBundle bundle : bundles) {
			if (!bundle.getInclusionPattern().isIncludeOnlyOnDebug()) {
				filteredBundles.add(bundle);
			}
		}
		return filteredBundles;
	}
822147
private function getDescSortedVersions(array $packages): array
    {
        usort($packages, function (PackageInterface $a, PackageInterface $b) {
            return version_compare($b->getVersion(), $a->getVersion());
        });

        return $packages;
    }
22618
def fetch_all_kernels(self):
        
        """
        api = self.doapi_manager
        for kern in api.paginate(self.url + '/kernels', 'kernels'):
            yield Kernel(kern, doapi_manager=api)
1265770
public function getClientMapping(array $bundles)
    {
        /** @var array $typesMapping Array of filtered mappings for the elasticsearch client*/
        $typesMapping = null;

        /** @var array $mappings All mapping info */
        $mappings = $this->getMappings($bundles);

        foreach ($mappings as $type => $mapping) {
            if (!empty($mapping['properties'])) {
                $typesMapping[$type] = array_filter(
                    array_merge(
                        ['properties' => $mapping['properties']],
                        $mapping['fields']
                    ),
                    function ($value) {
                        return (bool)$value || is_bool($value);
                    }
                );
            }
        }

        return $typesMapping;
    }
1370334
private function getController(KernelEvent $event): array
    {
        if (is_array($controller = explode('::', $event->getRequest()->get('_controller'))) && isset($controller[1])) {
            return $controller;
        }

        return [];
    }
689797
private function fetchFixtures()
    {
        $this->loader = $this->getFixtureLoader();

        $bundleDirectories = $this->autoload ? $this->getBundleFixtureDirectories() : array();

        $this->fetchFixturesFromDirectories($bundleDirectories);
        $this->fetchFixturesFromDirectories($this->directories ?: array());
        $this->fetchFixturesFromClasses($this->fixtures ?: array());

        return $this->loader->getFixtures();
    }
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;
    }
1248441
public function findBundleClasses(): array
    {
        /** @var string[][] $bundleSets */
        $bundleSets = [];

        $modules = $this->packageRepository->findModules();
        foreach ($modules as $module) {
            $extra = $module->getExtra();
            $this->validateBundlesSectionInExtra($extra);
            if (empty($extra['phplist/core']['bundles'])) {
                continue;
            }

            $bundleSets[$module->getName()] = $extra['phplist/core']['bundles'];
        }

        return $bundleSets;
    }
749933
private function getBundleResourcePaths(ContainerBuilder $container)
    {
        if ($container->hasParameter('kernel.bundles_metadata')) {
            $paths = $this->getBundlePathsUsingMetadata($container->getParameter('kernel.bundles_metadata'));
        } else {
            $paths = $this->getBundlePathsUsingNamedObj($container->getParameter('kernel.bundles'));
        }

        return array_map(function ($path) {
            return $path.DIRECTORY_SEPARATOR.'Resources'.DIRECTORY_SEPARATOR.'public';
        }, $paths);
    }
606524
public function getMappings(array $bundles)
    {
        $output = [];
        foreach ($bundles as $name => $bundleConfig) {
            // Backward compatibility hack for support.
            if (!is_array($bundleConfig)) {
                $name = $bundleConfig;
                $bundleConfig = [];
            }
            $mappings = $this->getBundleMapping($name, $bundleConfig);

            $alreadyDefinedTypes = array_intersect_key($mappings, $output);
            if (count($alreadyDefinedTypes)) {
                throw new \LogicException(
                    implode(',', array_keys($alreadyDefinedTypes)) .
                    ' type(s) already defined in other document, you can use the same ' .
                    'type only once in a manager definition.'
                );
            }

            $output = array_merge($output, $mappings);
        }

        return $output;
    }
1315787
private function getMappedPackageList(array $packages): array
    {
        $groupedPackages = $this->groupPackagesByName($packages);

        $mappedPackages = [];
        foreach ($groupedPackages as $name => $packages) {
            $highest = $this->getHighestVersion($packages);

            $mappedPackages[$name] = [
                'highest' => $highest,
                'abandoned' => $highest instanceof CompletePackageInterface ? $highest->isAbandoned() : false,
                'replacement' => $highest instanceof CompletePackageInterface ? $highest->getReplacementPackage() : null,
                'versions' => $this->getDescSortedVersions($packages),
            ];
        }

        return $mappedPackages;
    }
941145
private function getBundleValue(ResourceBundleInterface $bundle, string $key): array
    {
        return [
            BundleStorageInterface::INDEX_PAIR_VALUE  => $bundle->getValue($key),
            BundleStorageInterface::INDEX_PAIR_LOCALE => $bundle->getLocale(),
        ];
    }
18182
protected function getInstalledPluginBundles(\Symfony\Component\HttpKernel\KernelInterface $kernel)
    {
        $plugins = [];
        $bundles = $kernel->getBundles();

        foreach ($bundles as $bundle) {
            if (
                $bundle instanceof \Symfony\Component\HttpKernel\Bundle\Bundle &&
                $bundle instanceof \Elcodi\Component\Plugin\Interfaces\PluginInterface
            ) {
                $pluginNamespace = $bundle->getNamespace();
                $plugins[$pluginNamespace] = $bundle;
            }
        }

        return $plugins;
    }
861378
protected function resolveAndReturnBundleDependencies(
        KernelInterface $kernel,
        array $bundles
    ) {
        $cacheFile = $kernel->getCacheDir() . '/kernelDependenciesStack.php';
        if (!is_dir($kernel->getCacheDir())) {
            mkdir($kernel->getCacheDir(), 0777, true);
        }
        if (file_exists($cacheFile)) {
            return include $cacheFile;
        }

        $bundleStack = $this
            ->originalResolveAndReturnBundleDependencies(
                $kernel,
                $bundles
            );

        $this->cacheBuiltBundleStack(
            $bundleStack,
            $cacheFile
        );

        return $bundleStack;
    }