Finds the combinations where the specified mod names are the main mod of.
@param array|string[] $modNames
@return array|ModCombination[]
972204
public function findByModNames(array $modNames): array
    {
        $result = [];
        if (count($modNames) > 0) {
            $queryBuilder = $this->entityManager->createQueryBuilder();
            $queryBuilder->select(['mc', 'm'])
                         ->from(ModCombination::class, 'mc')
                         ->innerJoin('mc.mod', 'm')
                         ->andWhere('m.name IN (:modNames)')
                         ->addOrderBy('mc.order', 'ASC')
                         ->setParameter('modNames', array_values($modNames));

            $result = $queryBuilder->getQuery()->getResult();
        }
        return $result;
    }
450644
public function getModifiers()
    {
        $mods = $this->modifiers;
        if ($this->getIgnoreCase()) {
            $mods .= 'i';
        } elseif ($this->getIgnoreCase() === false) {
            $mods = str_replace('i', '', $mods);
        }
        if ($this->getMultiline()) {
            $mods .= 's';
        } elseif ($this->getMultiline() === false) {
            $mods = str_replace('s', '', $mods);
        }
        // filter out duplicates
        $mods = preg_split('//', $mods, -1, PREG_SPLIT_NO_EMPTY);
        $mods = implode('', array_unique($mods));

        return $mods;
    }
1093506
public function setDependencies(array $moduleNames)
    {
        $this->dependencies = array();

        foreach ($moduleNames as $moduleName) {
            $this->dependencies[$moduleName] = true;
        }
    }
311551
public function findDataByKeywords(array $keywords, array $modCombinationIds = []): array
    {
        $result = [];
        if (count($keywords) > 0) {
            $columns = [
                'r.id AS id',
                'r.name AS name',
                'r.mode AS mode',
                'mc.order AS order'
            ];

            $queryBuilder = $this->entityManager->createQueryBuilder();
            $queryBuilder->select($columns)
                         ->from(Recipe::class, 'r')
                         ->innerJoin('r.modCombinations', 'mc');

            $index = 0;
            foreach ($keywords as $keyword) {
                $queryBuilder->andWhere('r.name LIKE :keyword' . $index)
                             ->setParameter('keyword' . $index, '%' . addcslashes($keyword, '\\%_') . '%');
                ++$index;
            }

            if (count($modCombinationIds) > 0) {
                $queryBuilder->andWhere('mc.id IN (:modCombinationIds)')
                             ->setParameter('modCombinationIds', array_values($modCombinationIds));
            }

            $result = $this->mapRecipeDataResult($queryBuilder->getQuery()->getResult());
        }
        return $result;
    }
1270875
protected function sortModules(Collection $modules)
    {
        $index = 0;

        // Make a mapping to easily look up configured order with
        // Account for possibility of either 'module key' => [] or 'module key' format in config
        $orderMap = array_map(
            function ($key) {

                if (is_string($key)) return $key;

                if ( ! is_string($this->configModules[$key])) {
                    throw new UnexpectedValueException(
                        "cms-modules.menu.modules entry '{$key}' must be string or have a non-numeric key"
                    );
                }

                return $this->configModules[$key];
            },
            array_keys($this->configModules)
        );
        $orderMap = array_flip($orderMap);


        return $modules->sortBy(function (ModuleInterface $module) use (&$index, $orderMap) {

            // Order by configured order first, natural modules order second.
            if (count($orderMap)) {
                $primaryOrder = (int) array_get($orderMap, $module->getKey(), -2) + 1;
            } else {
                $primaryOrder = -1;
            }

            return $primaryOrder < 0 ? ++$index : (1 - 1 / $primaryOrder);
        });
    }
711181
protected function parseModuleSettings($moduleSettings)
    {
        $settings = [];

        if (is_array($moduleSettings)) {
            foreach ($moduleSettings as $setting) {
                $settings[] = $setting['name'];
            }
        }

        return $settings;
    }
1214502
public function findByTypesAndNames(array $namesByTypes, array $modCombinationIds = []): array
    {
        $queryBuilder = $this->entityManager->createQueryBuilder();
        $queryBuilder->select('i')
                     ->from(Item::class, 'i');

        $index = 0;
        $conditions = [];
        foreach ($namesByTypes as $type => $names) {
            $conditions[] = '(i.type = :type' . $index . ' AND i.name IN (:names' . $index . '))';
            $queryBuilder->setParameter('type' . $index, $type)
                         ->setParameter('names' . $index, array_values($names));
            ++$index;
        }

        $result = [];
        if ($index > 0) {
            $queryBuilder->andWhere('(' . implode(' OR ', $conditions) . ')');

            if (count($modCombinationIds) > 0) {
                $queryBuilder->innerJoin('i.modCombinations', 'mc')
                             ->andWhere('mc.id IN (:modCombinationIds)')
                             ->setParameter('modCombinationIds', array_values($modCombinationIds));
            }
            $result = $queryBuilder->getQuery()->getResult();
        }
        return $result;
    }
854481
public function getFieldNames(array $defaultNames)
    {
        $stack = array();

        if (empty($defaultNames)) {
            // throw user_error?
            return $stack;
        }

        foreach ($defaultNames as $defaultName) {
            $stack[] = $this->getFieldName($defaultName);
        }

        return $stack;
    }
236185
public function getModuleNames(AbstractNode $node): array
    {
        $docBlock = $this->getDocBlock($node);

        if ($docBlock === null) {
            return [];
        }

        $moduleTags = $docBlock->getTagsByName(static::TAG_MODULE);
        $moduleTags = $this->docBlockMapper->tagsToArray($moduleTags);

        return $moduleTags[static::TAG_MODULE] ?? [];
    }
1316161
public function findDataByHashes(array $hashes, array $modCombinationIds = []): array
    {
        $result = [];
        if (count($hashes) > 0) {
            $columns = [
                'i.id AS id',
                'IDENTITY(i.file) AS hash',
                'i.type AS type',
                'i.name AS name',
                'mc.order AS order'
            ];

            $queryBuilder = $this->entityManager->createQueryBuilder();
            $queryBuilder->select($columns)
                         ->from(Icon::class, 'i')
                         ->innerJoin('i.modCombination', 'mc')
                         ->andWhere('i.file IN (:hashes)')
                         ->setParameter('hashes', array_map('hex2bin', array_values($hashes)));

            if (count($modCombinationIds) > 0) {
                $queryBuilder->andWhere('mc.id IN (:modCombinationIds)')
                             ->setParameter('modCombinationIds', array_values($modCombinationIds));
            }

            $result = $this->mapIconDataResult($queryBuilder->getQuery()->getResult());
        }
        return $result;
    }
129051
public function getOptionsByModuleName($moduleName)
    {
        $moduleOptions = $this->resolveModuleOptionsByModuleName($moduleName);
        $this->validatePlugin($moduleOptions);

        return $moduleOptions;
    }
819795
Map<String, JSModule> getModulesByName() {
    Map<String, JSModule> result = new HashMap<>();
    for (JSModule m : modules) {
      result.put(m.getName(), m);
    }
    return result;
  }
1276556
public function getMods()
    {
        $mods = Podium::getInstance()->podiumCache->getElement('forum.moderators', $this->id);
        if ($mods === false) {
            $mods = [];
            $modteam = User::find()->select(['id', 'role'])->where([
                    'status' => User::STATUS_ACTIVE,
                    'role' => [User::ROLE_ADMIN, User::ROLE_MODERATOR]
                ]);
            foreach ($modteam->each() as $user) {
                if ($user->role == User::ROLE_ADMIN) {
                    $mods[] = $user->id;
                    continue;
                }
                if ((new Query())->from(Mod::tableName())->where([
                        'forum_id' => $this->id, 'user_id' => $user->id
                    ])->exists()) {
                    $mods[] = $user->id;
                }
            }
            Podium::getInstance()->podiumCache->setElement('forum.moderators', $this->id, $mods);
        }
        return $mods;
    }
720584
public function getAllowedModules(array $entityClassNames = [])
    {
        $moduleOptionsManager = $this->getModuleOptionsPluginManager();
        $allowedModules = [];
        foreach ($entityClassNames as $entityClassName) {
            if ($moduleOptionsManager->hasModuleNameByClassName($entityClassName)) {
                $moduleName = $moduleOptionsManager->getModuleNameByClassName($entityClassName);
                $allowedModules[$moduleName] = $moduleName;
            }
        }

        return  $allowedModules;
    }
1298931
function modGetModulesExports( modules, buildinModules ) {
        var args = [];
        each(
            modules,
            function ( moduleId ) {
                args.push(
                    buildinModules[ moduleId ]
                    || modGetModuleExports( moduleId )
                );
            }
        );

        return args;
    }
85242
public function findByKeywords(array $keywords, array $modCombinationIds = []): array
    {
        $result = [];
        if (count($keywords) > 0) {
            $queryBuilder = $this->entityManager->createQueryBuilder();
            $queryBuilder->select('i')
                         ->from(Item::class, 'i');

            $index = 0;
            foreach ($keywords as $keyword) {
                $queryBuilder->andWhere('i.name LIKE :keyword' . $index)
                             ->setParameter('keyword' . $index, '%' . addcslashes($keyword, '\\%_') . '%');
                ++$index;
            }

            if (count($modCombinationIds) > 0) {
                $queryBuilder->innerJoin('i.modCombinations', 'mc')
                             ->andWhere('mc.id IN (:modCombinationIds)')
                             ->setParameter('modCombinationIds', array_values($modCombinationIds));
            }

            $result = $queryBuilder->getQuery()->getResult();
        }
        return $result;
    }
213008
public static function getFilters($filterNames = null)
    {
        if (! is_null($filterNames)) {
            if (! is_array($filterNames)) {
                $filterNames = [ $filterNames ];
            }

            return array_only(static::$filters, $filterNames);
        } else {
            return static::$filters;
        }
    }