filters the bundlelist according to ENV vars

@param array $bundleList bundle list

@return array filtered bundle list
329026
private function filterBundleList(array $bundleList)
    {
        $groups = [];
        foreach ($_ENV as $name => $val) {
            if (substr($name, 0, strlen($this->envDynGroupPrefix)) == $this->envDynGroupPrefix) {
                $groups[substr($name, strlen($this->envDynGroupPrefix))] = $val;
            }
        }

        if (empty($groups)) {
            // no groups.. exit
            return $bundleList;
        }

        foreach ($groups as $groupName => $filter) {
            if (isset($_ENV[$this->envDynSettingPrefix.$groupName]) &&
                $_ENV[$this->envDynSettingPrefix.$groupName] == 'false'
            ) {
                $bundleList = array_filter(
                    $bundleList,
                    function ($value) use ($filter) {
                        if (preg_match('/'.$filter.'/i', $value) || empty(trim($value))) {
                            return false;
                        }
                        return true;
                    }
                );
            }
        }

        return $bundleList;
    }
549512
public BundleList findExtraBundles(BundleList newBundleList, FeatureManager featureManager) {
        List<RuntimeFeatureResource> bundles = new ArrayList<RuntimeFeatureResource>(resources);
        bundles.removeAll(newBundleList.resources);
        resources.removeAll(bundles);
        BundleList result = new BundleList(featureManager);
        result.resources.addAll(bundles);
        stale.set(true);
        return result;
    }
1089722
public function getAllBundles() {
		if($this->bundles === null)
			$this->bundles = $this->doGetBundles();
		return $this->bundles;
	}
1178801
protected function filter(array $list)
    {
        $tmp = [];
        foreach ($list as $item) {
            if ($item['anime']) {
                $tmp[] = $item;
            }
        }
        return $tmp;
    }
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;
    }
732418
public function getAttributeIds($bundle = null)
    {
        $attributes = $this->attributes($bundle);
        $ids = [];

        foreach ($attributes as $name => $info) {
            $ids[] = $info['id'];
        }

        return $ids;
    }
741305
public function getMigrationStatus(Bundle $bundle)
    {
        $config = $this->getConfiguration($bundle);

        if (is_dir($config->getMigrationsDirectory())) {
            $currentVersion = $config->getCurrentVersion();
            $availableVersions = $config->getAvailableVersions();
            array_unshift($availableVersions, '0');
        } else {
            $currentVersion = '0';
            $availableVersions = [];
        }

        return [
            self::STATUS_CURRENT => $currentVersion,
            self::STATUS_AVAILABLE => $availableVersions,
            self::VERSION_LATEST => $config->getLatestVersion(),
        ];
    }
1240240
public function getBundles($extension = null)
    {
        if ($extension === null) {
            return $this->bundles;
        }
        elseif (isset($this->bundles[$extension])) {
            return $this->bundles[$extension];
        }
        else {
            return null;
        }
    }
1027910
public function getBundeled() : array
    {
        $directory = MODULARITY_PATH . 'source/php/Module/';
        $bundeled = array();

        foreach (@glob($directory . "*", GLOB_ONLYDIR) as $folder) {
            $bundeled[$folder] = basename($folder);
        }

        return $bundeled;
    }
1075430
public void setBundleList(java.util.Collection<BundleDetails> bundleList) {
        if (bundleList == null) {
            this.bundleList = null;
            return;
        }

        this.bundleList = new java.util.ArrayList<BundleDetails>(bundleList);
    }
1035928
public function filterFeature(FeatureNode $feature)
    {
        $scenarios = array();
        foreach ($feature->getScenarios() as $scenario) {
            if (!$this->isScenarioMatch($scenario)) {
                continue;
            }

            if ($scenario instanceof OutlineNode && $scenario->hasExamples()) {
                $table = $scenario->getExampleTable()->getTable();
                $lines = array_keys($table);

                $filteredTable = array($lines[0] => $table[$lines[0]]);
                unset($table[$lines[0]]);

                foreach ($table as $line => $row) {
                    if ($this->filterMinLine <= $line && $this->filterMaxLine >= $line) {
                        $filteredTable[$line] = $row;
                    }
                }

                $scenario = new OutlineNode(
                    $scenario->getTitle(),
                    $scenario->getTags(),
                    $scenario->getSteps(),
                    new ExampleTableNode($filteredTable, $scenario->getExampleTable()->getKeyword()),
                    $scenario->getKeyword(),
                    $scenario->getLine()
                );
            }

            $scenarios[] = $scenario;
        }

        return new FeatureNode(
            $feature->getTitle(),
            $feature->getDescription(),
            $feature->getTags(),
            $feature->getBackground(),
            $scenarios,
            $feature->getKeyword(),
            $feature->getLanguage(),
            $feature->getFile(),
            $feature->getLine()
        );
    }
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;
    }
798334
public function getFilterOptions($idList, $usedOnly, &$arrCount = null)
    {
        if (!$this->isFilterOptionRetrievingPossible($idList)) {
            return [];
        }

        $strDisplayValue    = $this->getValueColumn();
        $strSortingValue    = $this->getSortingColumn();
        $strCurrentLanguage = null;

        // Change language.
        if (TL_MODE == 'BE') {
            $strCurrentLanguage     = $GLOBALS['TL_LANGUAGE'];
            $GLOBALS['TL_LANGUAGE'] = $this->getMetaModel()->getActiveLanguage();
        }

        $filter = $this->getSelectMetaModel()->getEmptyFilter();

        $this->buildFilterRulesForFilterSetting($filter);

        // Add some more filter rules.
        if ($usedOnly || ($idList && \is_array($idList))) {
            $this->buildFilterRulesForUsedOnly($filter, $idList ?: []);
        }

        $objItems = $this->getSelectMetaModel()->findByFilter($filter, $strSortingValue);

        // Reset language.
        if (TL_MODE == 'BE') {
            $GLOBALS['TL_LANGUAGE'] = $strCurrentLanguage;
        }

        return $this->convertItemsToFilterOptions(
            $objItems,
            $strDisplayValue,
            $this->getAliasColumn(),
            $arrCount,
            $idList
        );
    }
1174363
public function getList(array $options = array())
    {
        $options += array('index' => 'product_bundle_id');

        $result = &gplcart_static(gplcart_array_hash(array('product.bundle.list' => $options)));

        if (isset($result)) {
            return $result;
        }

        $this->hook->attach('product.bundle.list.before', $options, $result, $this);

        if (isset($result)) {
            return $result;
        }

        $conditions = array();

        $sql = 'SELECT pb.*, p.store_id
                FROM product_bundle pb
                LEFT JOIN product p ON(pb.product_id = p.product_id)
                LEFT JOIN product p2 ON(pb.item_product_id = p2.product_id)';

        if (isset($options['product_bundle_id'])) {
            $sql .= ' WHERE pb.product_bundle_id = ?';
            $conditions[] = $options['product_bundle_id'];
        } else {
            $sql .= ' WHERE pb.product_bundle_id IS NOT NULL';
        }

        if (isset($options['store_id'])) {
            $sql .= ' AND p.store_id = ? AND p2.store_id = ?';
            $conditions[] = $options['store_id'];
            $conditions[] = $options['store_id'];
        }

        if (isset($options['status'])) {
            $sql .= ' AND p.status = ? AND p2.status = ?';
            $conditions[] = (int) $options['status'];
            $conditions[] = (int) $options['status'];
        }

        if (isset($options['product_id'])) {
            $sql .= ' AND pb.product_id = ?';
            $conditions[] = $options['product_id'];
        }

        if (!empty($options['limit'])) {
            $sql .= ' LIMIT ' . implode(',', array_map('intval', $options['limit']));
        }

        $result = $this->db->fetchAll($sql, $conditions, array('index' => $options['index']));
        $this->hook->attach('product.bundle.list.after', $options, $result, $this);
        return $result;
    }
1069162
public static function getRootDir($bundlepath = false)
    {
        if (static::isSymfony()) {
            $dir = dirname(static::getCont()->getParameter('kernel.root_dir'));

            if (is_object($bundlepath)) {
                $path = get_class($bundlepath);
                $bundle = preg_replace('#^(.*?\\\\[^\\\\]+Bundle)\\\\.*$#', '$1', $path);
                if ($path !== $bundle) {
                    $bundle = str_replace('\\', '/', $bundle);

                    return static::getRootDir().'/src/'.$bundle;
                }
                throw new Exeption("Can't analyse path '$path' to find bundle directory");
            }
            if ($bundlepath) {
                return static::getKernel()->getBundle($bundlepath)->getPath();
    //            $n = get_called_class();
    //            $n = substr($n, 0, -strlen(strrchr($n, '\\')));
    //            $n = substr($n, 0, -strlen(strrchr($n, '\\')));
    //            $n = str_replace('\\', '/', $n);
    //            $dir .= "/src/$n";
            }

            return $dir;
        } else {
            if ($bundlepath !== false) {
                throw new Exception("This is not Symfony 2, can't user getRootDir with parameter");
            }
            // nie wiem czy to najlepsze ale najwyżej później to wymienie
            if (!static::$root) {
                $reflection = new ReflectionClass('Composer\Autoload\ClassLoader');
                static::$root = str_replace('\\', '/', dirname(dirname(dirname($reflection->getFileName()))));
            }

            return static::$root;
        }
    }
637413
public function setBundle(AbstractBundle $bundle)
    {
        $data = $bundle->getValues();
        foreach ($data as $name => $value) {
            $query = $this->getNewQuery();
            $query = $bundle->makeQueryFiltered($query);
            $setting = $query->firstOrNew(['name' => $name]);
            $setting->value = $value;
            $setting->save();
        }
    }
578246
private function encodeMergedBundles(
        ResourceBundleInterface $localizedBundle,
        ResourceBundleInterface $defaultBundle = null
    ): array {
        if ($defaultBundle === null) {
            // there is no default bundle for this localized one
            return $this->encodeBundle($localizedBundle);
        }

        $localizedKeys = $localizedBundle->getKeys();
        $defaultKeys   = $defaultBundle->getKeys();

        $commonKeys        = array_intersect($localizedKeys, $defaultKeys);
        $localizedOnlyKeys = array_diff($localizedKeys, $commonKeys);
        $defaultOnlyKeys   = array_diff($defaultKeys, $commonKeys);

        $encodedBundle = [];

        foreach ($commonKeys as $key) {
            $encodedBundle[$key] = $this->getBundleValue($localizedBundle, (string)$key);
        }
        foreach ($localizedOnlyKeys as $key) {
            $encodedBundle[$key] = $this->getBundleValue($localizedBundle, (string)$key);
        }
        foreach ($defaultOnlyKeys as $key) {
            $encodedBundle[$key] = $this->getBundleValue($defaultBundle, (string)$key);
        }

        return $encodedBundle;
    }