Run all the checkers according to their configs.

@param ConfigCollection  $configCollection  The config collection instance.
@param CheckerCollection $checkerCollection The checker collection instance.

@return ResultCollection
436269
public static function check(
        ConfigCollection $configCollection,
        CheckerCollection $checkerCollection
    ): ResultCollection {
        $resultCollection = new ResultCollection();

        foreach ($checkerCollection->all() as $id => $checker) {
            $resultCollection->add(
                $checker->check(
                    $configCollection->getConfig($id)
                )
            );
        }

        return $resultCollection;
    }
519931
public function load(array $configs, ContainerBuilder $container)
    {
        // Load DoctrineMongoDBBundle/Resources/config/mongodb.xml
        $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));

        $configuration = new Configuration();
        $config        = $this->processConfiguration($configuration, $configs);

        $loader->load('mongodb.xml');

        if (empty($config['default_connection'])) {
            $keys                         = array_keys($config['connections']);
            $config['default_connection'] = reset($keys);
        }
        $container->setParameter('doctrine_mongodb.odm.default_connection', $config['default_connection']);

        if (empty($config['default_document_manager'])) {
            $keys                               = array_keys($config['document_managers']);
            $config['default_document_manager'] = reset($keys);
        }
        $container->setParameter('doctrine_mongodb.odm.default_document_manager', $config['default_document_manager']);

        // set some options as parameters and unset them
        $config = $this->overrideParameters($config, $container);

        // set the fixtures loader
        $container->setParameter('doctrine_mongodb.odm.fixture_loader', $config['fixture_loader']);

        // load the connections
        $this->loadConnections($config['connections'], $container);

        $config['document_managers'] = $this->fixManagersAutoMappings($config['document_managers'], $container->getParameter('kernel.bundles'));

        // load the document managers
        $this->loadDocumentManagers(
            $config['document_managers'],
            $config['default_document_manager'],
            $config['default_database'],
            $container
        );

        if ($config['resolve_target_documents']) {
            $def = $container->findDefinition('doctrine_mongodb.odm.listeners.resolve_target_document');
            foreach ($config['resolve_target_documents'] as $name => $implementation) {
                $def->addMethodCall('addResolveTargetDocument', [$name, $implementation, []]);
            }
            $def->addTag('doctrine_mongodb.odm.event_listener', ['event' => 'loadClassMetadata']);
        }

        // BC Aliases for Document Manager
        $container->setAlias('doctrine.odm.mongodb.document_manager', new Alias('doctrine_mongodb.odm.document_manager'));

        $container->registerForAutoconfiguration(ServiceDocumentRepositoryInterface::class)
            ->addTag(ServiceRepositoryCompilerPass::REPOSITORY_SERVICE_TAG);
    }
723395
public function fromRepository(CheckedOutRepository $checkedOutRepository) : VersionsCollection
    {
        $output = (new Process(['git', 'tag', '-l']))
            ->setWorkingDirectory($checkedOutRepository->__toString())
            ->mustRun()
            ->getOutput();

        return new VersionsCollection(...array_filter(
            array_map(static function (string $maybeVersion) : ?Version {
                try {
                    return Version::fromString($maybeVersion);
                } catch (InvalidVersionStringException $e) {
                    return null;
                }
            }, explode("\n", $output))
        ));
    }
993002
public static function sortBy($collection = null, $iterator = null, $sort_flag = null)
    {
        $results = array();
        foreach ($collection as $k => $item) {
            if (is_callable($iterator)) {
                $results[$k] = $iterator($item);
            }
            if (is_object($item)) {
                $results[$k] = $item->$iterator;
            } elseif (is_array($item)) {
                $results[$k] = $item[$iterator];
            }
        }
        $sort_flag = (is_null($sort_flag)) ? SORT_REGULAR : $sort_flag;
        asort($results, $sort_flag);
        foreach ($results as $k => $v) {
            $results[$k] = $collection[$k];
        }
        return $results;
    }
967751
public function loadValidatorsFromService(BBcodeValidatorCollectionInterface $collection)
    {
        foreach ($collection->getValidators() as $validator) {
            $this->validators[$validator->getName()] = $validator;
        }
    }
874519
function(){
      return {
        collection: configCollection,
        data: config.data,
        query: config.query,
        offset: config.offset,
        limit: config.limit,
        where: config.where,
        filter: config.filter,
        filters: config.filters,
        watch: config.watch,
        sort: config.sort
      };
    }
617094
public function intersect($collection)
    {
        $intersection = new DefaultCollection();
        /** @var ModelInterface $localModel */
        foreach ($this as $localModel) {
            /** @var ModelInterface $otherModel */
            foreach ($collection as $otherModel) {
                if (($localModel->getProviderName() === $otherModel->getProviderName())
                    && ($localModel->getId() === $otherModel->getId())
                ) {
                    $intersection->push($localModel);
                }
            }
        }

        return $intersection;
    }
579621
public function getCheckerFromFQCN($checkerName)
    {
        $checkerName = trim($checkerName, '\\');
        if (!class_exists($checkerName)) {
            throw new \RuntimeException('Checker FQCN does not exists');
        }

        foreach ($this->checkers as $checker) {
            if ($checker instanceof $checkerName) {
                return $checker;
            }
        }

        throw new RuntimeException('Checker could not be found');
    }
665263
public static function run(): void
    {
        foreach (self::CHECKERS as $checker) {
            WP_CLI::add_wp_hook(CheckerCollectionFactory::REGISTER_HOOK, [$checker, 'register']);
        }
    }
787583
public function sync($collection)
    {
        foreach ($collection as $item) {
            $websiteId = $item->getWebsiteId();
            $file = $item->getImportFile();
            if ($this->helper->isEnabled($websiteId)) {
                $this->client = $this->helper->getWebsiteApiClient($websiteId);

                $addressBook = $this->_getAddressBook(
                    $item->getImportType(),
                    $websiteId
                );

                if (! empty($file) && ! empty($addressBook) && $this->client) {
                    if ($this->helper->fileHelper->isFilePathExistWithFallback($file)) {
                        //import contacts from csv file
                        $result = $this->client->postAddressBookContactsImport($file, $addressBook);
                        $this->_handleItemAfterSync($item, $result);
                    } else {
                        $item->setImportStatus(\Dotdigitalgroup\Email\Model\Importer::FAILED)
                            ->setMessage(__('CSV file does not exist in email or archive folder.'));
                        $this->importerResource->save($item);
                    }
                }
            }
        }
    }
167747
public function generateReports(SuiteCollection $collection, array $reportNames)
    {
        $reportDoms = [];
        $reportConfigs = [];

        foreach ($reportNames as $reportName) {
            $reportConfigs[$reportName] = $this->generatorRegistry->getConfig($reportName);
        }

        foreach ($reportConfigs as $reportName => $reportConfig) {
            $generatorName = $reportConfig['generator'];
            $generator = $this->generatorRegistry->getService($generatorName);

            $reportDom = $generator->generate($collection, $reportConfig);

            if (!$reportDom instanceof Document) {
                throw new \RuntimeException(sprintf(
                    'Report generator "%s" should have return a PhpBench\Dom\Document class, got: "%s"',
                    $generatorName,
                    is_object($reportDom) ? get_class($reportDom) : gettype($reportDom)
                ));
            }

            $reportDom->schemaValidate(__DIR__ . '/schema/report.xsd');

            $reportDoms[] = $reportDom;
        }

        return $reportDoms;
    }
484075
public function union( common_Collection $collection)
    {
        $returnValue = null;

        
        $returnValue = new core_kernel_classes_ContainerCollection($this);     
        $returnValue->sequence = array_merge($this->sequence, $collection->sequence );      
        

        return $returnValue;
    }
89797
public function setConfigSection(\VinceT\AdminConfigurationBundle\Entity\ConfigSection $configSection)
    {
        $this->configSection = $configSection;

        return $this;
    }
341908
protected function generateItems(array $collection)
    {
        $this->_items = [];
        $this->_children = [];

        foreach ($collection as $c) {

            foreach ($c as $key => $value) {
                if (is_array($value)) {

                    if (count($value) == 1 && isset($value['children']) && is_array($value['children'])) {
                        if (!isset($this->_children[$key])) {
                            $this->_children[$key] = [];
                        }

                        foreach ($value['children'] as $kid) {
                            $this->_children[$key][] = $kid;
                        }

                        continue;
                    }

                    if (!isset($value['type'])) {
                        throw new InvalidConfigException('Please specify type for ' . $key . ' auth item!');
                    }

                    if ($value['type'] == Item::TYPE_ROLE) {
                        $item = $this->_auth->createRole($key);
                    } elseif ($value['type'] == Item::TYPE_PERMISSION) {
                        $item = $this->_auth->createPermission($key);
                    } else {
                        throw new InvalidConfigException('Wrong type for ' . $key . ' auth item! Type can be ' . Item::TYPE_ROLE . ' (role) or ' . Item::TYPE_PERMISSION . ' (permission).');
                    }

                    $item->description = isset($value['description']) ? $value['description'] : null;
                    $item->data = isset($value['data']) ? $value['data'] : null;

                    if (isset($value['rule']) && $value['rule'] instanceof Rule) {
                        /** @var Rule $rule */
                        $rule = $value['rule'];
                        $rule->updatedAt = time();
                        $item->ruleName = !empty($rule->name) ? $rule->name : get_class($rule);
                        $this->_items[$item->ruleName] = $rule;
                    }

                    if (isset($value['children']) && is_array($value['children'])) {

                        if (!isset($this->_children[$key])) {
                            $this->_children[$key] = [];
                        }

                        foreach ($value['children'] as $kid) {
                            $this->_children[$key][] = $kid;
                        }
                    }

                } else {
                    $item = $this->_auth->createPermission($key);
                    $item->description = $value;
                }

                $this->_items[$key] = $item;
            }
        }
    }
1099664
protected function run(Config $config): ResultInterface
    {
        $includes = $config->compileIncludes();

        return $this->validator->validate(...$includes);
    }
1362781
protected function run(Config $config): ResultInterface
    {
        $includes = $config->compileIncludes();

        $constants = [];
        foreach ($includes as $key) {
            // phpcs:ignore WordPressVIPMinimum.Constants.ConstantString.NotCheckingConstantName
            $constants[$key] = defined($key)
                ? (string) constant($key)
                : '';
        }

        $duplicatedValues = array_values(
            array_diff_assoc(
                $constants,
                array_unique($constants)
            )
        );

        $duplicated = array_keys(
            array_filter($constants, function (string $value) use ($duplicatedValues): bool {
                return in_array($value, $duplicatedValues, true);
            })
        );

        if (! empty($duplicated)) {
            $messages = array_merge(['Salt constants are not unique(or not defined):'], $duplicated);

            return ResultFactory::makeFailure($this, $messages);
        }

        return ResultFactory::makeSuccess($this);
    }
844627
@SuppressWarnings("unchecked")
  private boolean handleCollection(
    final ConfigurationContext ctx,
    final Class<?> _type,
    final Object cfg,
    final ParsedConfiguration _parsedCfg) {
    String _containerName = _parsedCfg.getContainer();
    Method m;
    try {
      m = cfg.getClass().getMethod(constructGetterName(_containerName));
    } catch (NoSuchMethodException ex) {
      return false;
    }
    if (!Collection.class.isAssignableFrom(m.getReturnType())) {
      return false;
    }
    Collection c;
    try {
      c = (Collection) m.invoke(cfg);
    } catch (Exception ex) {
      throw new ConfigurationException("Cannot access collection for '" + _containerName + "' " + ex, _parsedCfg);
    }
    Object _bean = createBeanAndApplyConfiguration(ctx, _type, _parsedCfg);
    try {
      c.add(_bean);
    } catch (IllegalArgumentException ex) {
      throw new ConfigurationException("Rejected add '" + _containerName + "': " + ex.getMessage(), _parsedCfg);
    }
    return true;
  }