@param \Illuminate\Support\Collection|\Tightenco\Collect\Support\Collection $collection
@param \Spatie\Crawler\CrawlUrl                                             $searchCrawlUrl

@return bool
494273
protected function contains($collection, CrawlUrl $searchCrawlUrl): bool
    {
        foreach ($collection as $crawlUrl) {
            if ((string) $crawlUrl->url === (string) $searchCrawlUrl->url) {
                return true;
            }
        }

        return false;
    }
581041
public function has($crawlUrl): bool
    {
        if (! $crawlUrl instanceof CrawlUrl) {
            $crawlUrl = CrawlUrl::create($crawlUrl);
        }

        if ($this->contains($this->urls, $crawlUrl)) {
            return true;
        }

        return false;
    }
28827
public static function addCollection($collection)
  {
    static::checkConnexion();
    $r = self::$db->createCollection($collection);
    if (gettype($r) == 'object' && get_class($r) == 'MongoCollection') {
      return true;
    }
    return false;
  }
1338162
protected function getInitializedSearchResultSet(SearchRequest $searchRequest):SearchResultSet
    {
        /** @var $resultSet SearchResultSet */
        $resultSetClass = $this->getResultSetClassName();
        $resultSet = GeneralUtility::makeInstance($resultSetClass);

        $resultSet->setUsedSearchRequest($searchRequest);
        $resultSet->setUsedPage((int)$searchRequest->getPage());
        $resultSet->setUsedResultsPerPage((int)$searchRequest->getResultsPerPage());
        $resultSet->setUsedSearch($this->search);
        return $resultSet;
    }
21354
public function sync($collection)
    {
        foreach ($collection as $item) {
            $result = true;
            $websiteId = $item->getWebsiteId();
            if ($this->helper->isEnabled($websiteId)) {
                $this->client = $this->helper->getWebsiteApiClient($websiteId);
                $importData = $this->serializer->unserialize($item->getImportData());

                if ($this->client) {
                    $key = $importData[0];
                    $collectionName = $item->getImportType();
                    $this->client->deleteContactsTransactionalData($key, $collectionName);
                    $this->_handleSingleItemAfterSync($item, $result);
                }
            }
        }
    }
751375
private function isCollectionDynamic(Collection $collection): bool
    {
        try {
            $this->loadCollectionQuery($collection);
        } catch (NotFoundException $e) {
            return false;
        }

        return true;
    }
1332507
public static function collectionContains($needle, $haystack)
    {
        foreach ($haystack as $value) {
            if ($value === $needle) {
                return true;
            }
        }

        return false;
    }
636969
public function seeNumElementsInCollection($collection, $expected, $criteria = [])
    {
        $collection = $this->driver->getDbh()->selectCollection($collection);
        $res = $collection->count($criteria);
        \PHPUnit\Framework\Assert::assertSame($expected, $res);
    }
295925
public function searchCollection($query, CollectionSearchQuery $parameters, array $headers = [])
    {
        $data = $this->getApi()->searchCollection($query, $this->getParameters($parameters), $headers);

        return $this->getCollectionFactory()->createResultCollection($data);
    }
934407
public function match(RecordCollection $collection, RecordCollection $recordsLoaded)
    {
        $dictionary = $this->buildDictionary($recordsLoaded);

        foreach ($collection as $record) {
            /** @var Record $record */
            $results = $this->getResultsFromCollectionDictionary($dictionary, $collection, $record);
            /** @noinspection PhpUnhandledExceptionInspection */
            $record->getRelation($this->getName())->setResults($results);
        }

        return $recordsLoaded;
    }
682501
protected function setPagerListCollectionItem()
    {
        $options = $this->query_filter;
        $options['count'] = true;
        $options['collection_id'] = $this->data_collection['collection_id'];

        $pager = array(
            'query' => $this->query_filter,
            'total' => (int) $this->collection_item->getList($options)
        );

        return $this->data_limit = $this->setPager($pager);
    }
1073705
function getCollection(items, query, cb, argsLength) {
  var skip = 0, limit = Number.MAX_SAFE_INTEGER;
  setImmediate(function() {
    if (argsLength === 1) {
      cb = query;
    } else {
      skip = (query.skip) ? query.skip : 0;
      limit = (query.limit) ? query.limit : Number.MAX_SAFE_INTEGER;
    }
    var sortedKeys = Object.keys(items);
    var qKeys = remove(remove(Object.keys(query), /skip/), /limit/);
    qKeys.forEach(function (k) {
      try {
        var re = new RegExp(query[k]);
        sortedKeys = sortedKeys.filter(function (l) {
          return items[l][k].toString().match(re);
        });
      } catch (e) {
        console.error(`Problem filtering collection for parameter ${k}.`,
          e.message);
      }
    });
    skip = checkSkip(skip, sortedKeys);
    limit = checkLimit(limit, sortedKeys);
    if (sortedKeys.length === 0 || limit === 0 || skip >= sortedKeys.length) {
      return cb(null, [], sortedKeys.length, 1, 1, 0);
    }
    var pages = Math.ceil(sortedKeys.length / limit);
    var pageOf = Math.ceil(skip / limit) + 1;
    var itemArray = new Array();
    for ( var x = skip ; x < Math.min(skip + limit, sortedKeys.length) ; x++ ) {
      itemArray.push(items[sortedKeys[x]]);
    }
    cb(null, itemArray, sortedKeys.length, pageOf, pages, itemArray.length);
  });
}
367045
public function getRequest(\Magento\Framework\Api\Search\SearchCriteriaInterface $searchCriteria)
    {
        $storeId = $this->getCurrentStoreId();

        $containerName = $searchCriteria->getRequestName();

        $containerConfiguration = $this->getSearchContainerConfiguration($storeId, $containerName);

        $size = $searchCriteria->getPageSize() ?? self::DEFAULT_PAGE_SIZE;
        $from = max(0, (int) $searchCriteria->getCurrentPage() - 1) * $size;

        $queryText  = $this->getFulltextFilter($searchCriteria);

        $sortOrders = $this->requestMapper->getSortOrders($containerConfiguration, $searchCriteria);
        $filters    = $this->requestMapper->getFilters($containerConfiguration, $searchCriteria);

        $this->updateSearchContext($storeId, $queryText);

        return $this->searchRequestBuilder->create($storeId, $containerName, $from, $size, $queryText, $sortOrders, $filters, []);
    }
1091225
private function trackCollection(Collection $collection)
    {
        $blocks = $collection->getBlocks();
        $this->trackBlocks($collection, $blocks);

        $attributes = $collection->getSetCollectionAttributes();
        $this->trackAttributes($collection, $attributes);
    }
224442
private function userHasRequestedARegistrationOnCollection(\collection $collection, $userData)
    {
        if (null === $userRegistration = igorw\get_in($userData, [$collection->get_sbas_id(), $collection->get_base_id()])) {
            return false;
        }

        return !is_null($userRegistration['active']);
    }
303799
public function addCollection(RuleCollection $collection)
    {
        foreach ($collection as $name => $rule) {
            $this->set($name, $rule);
        }
    }
926292
public function execute(SearchParams $searchParams) {
        $path = self::getPath($searchParams);
        $builder = new UrlParamsBuilder($searchParams);
        return $this->openSearchClient->get($path, $builder->getHttpParams());
    }