Internal method for filtering

@param array|Collection $set
@param string $filterProperty
@param boolean $negate
@return array
480023
protected function filterInternal($set, $filterProperty, $negate)
    {
        if (is_object($set) && $set instanceof Collection) {
            $set = $set->toArray();
        }

        return array_filter($set, function ($element) use ($filterProperty, $negate) {
            $result = (boolean)ObjectAccess::getPropertyPath($element, $filterProperty);
            if ($negate) {
                $result = !$result;
            }

            return $result;
        });
    }
632975
protected synchronized void filter(ValueSet filterValueSet) {
        boolean explicitBufferEmpty = this.explicitBuffer.isEmpty();
        boolean scanBufferEmpty = this.scanBuffer.isEmpty();
        if (filterValueSet != null && !filterValueSet.isEmpty() && (!explicitBufferEmpty || !scanBufferEmpty)) {
            Iterator it = filterValueSet.iterator();
            while (it.hasNext()) {
                Object o = it.next();
                if (!explicitBufferEmpty && this.explicitBuffer.containsKey(o)) {
                    it.remove();
                } else if (!scanBufferEmpty && this.scanBuffer.contains(o)) {
                    it.remove();
                }
            }
        }
    }
362842
function set ($filters)
  {
    // On objects, all methods named `filter_xxx` (where xxx is a filter name) are registered as filters (with the
    // `filter_` prefix stripped).
    if (is_object ($filters)) {
      $keys    = mapAndFilter (array_diff (get_class_methods ($filters), ['__construct']), function ($f) {
        return substr ($f, 0, 7) == 'filter_' ? substr ($f, 7) : null;
      });
      $values  = array_map (function ($v) use ($filters) { return [$filters, "filter_$v"]; }, $keys);
      $filters = array_combine ($keys, $values);
    };
    if (is_array ($filters))
      array_mergeInto ($this->filters, $filters);
    else throw new \InvalidArgumentException("<kbd>filters</kbd> argument is invalid");
  }
1058877
public function diff( \PhpSets\Set $set ) {
        $entries = $this->entries();
        $iterator = $set->entries();
        $intersect = new \PhpSets\Set;

        // check $set values
        while ( $entries->valid() ) {
            if ( ! $set->has( $entries->current() ) ) {
                $intersect->add( $entries->current() );
            }

            $entries->next();
        }

        // check $additionalSet values
        while ( $iterator->valid() ) {
            if ( ! $this->has( $iterator->current() ) ) {
                $intersect->add( $iterator->current() );
            }

            $iterator->next();
        }

        return $intersect;
    }
1160455
public function Filter( $facts, $variableSet )
	{
		// If the filter is being used in a boolean filter or there is a qname expresssion then return the input facts
		if ( $this->inBoolean || $this->qnameExpressions ) return $facts;

		$matched = array();
		$notMatched = array();

		foreach ( $facts as /** @var XPathNavigator $fact */ $fact )
		{
			if ( $this->testParent( $fact ) )
			{
				$matched[] = $fact->CloneInstance();
			}
			else
			{
				$notMatched[] = $fact->CloneInstance();
			}
		}

		return DocumentOrderNodeIterator::fromItemset( $this->complement ? $notMatched : $matched );
	}
233491
def apply_filter(
        filter_fn,
        collection,
        result_fn=None,
        filter_name="",
        collection_name=""):
    
    n_before = len(collection)
    filtered = [x for x in collection if filter_fn(x)]
    n_after = len(filtered)
    if not collection_name:
        collection_name = collection.__class__.__name__
    logging.info(
        "%s filtering removed %d/%d entries of %s",
        filter_name,
        (n_before - n_after),
        n_before,
        collection_name)
    return result_fn(filtered) if result_fn else collection.__class__(filtered)
649053
public function thereTheEmailContains($negate, $content)
	{
		if(!$this->lastMatchedEmail) {
			throw new \LogicException('No matched email found from previous step');
		}

		$email = $this->lastMatchedEmail;
		$emailContent = null;
		if($email->Content) {
			$emailContent = $email->Content;
		} else {
			$emailContent = $email->PlainContent;
		}

		if(trim($negate)) {
			assertNotContains($content, $emailContent);
		} else {
			assertContains($content, $emailContent);
		}
	}
1327060
public function set($key, $value = null, $filter = null)
	{
		parent::set($key, $value);

		if (is_array($key))
		{
			if (is_bool($value))
			{
				$filter = $value;
			}

			foreach ($key as $_key => $_value)
			{
				$this->filterIndex[$_key] = $filter;
			}
		}
		else
		{
			$this->filterIndex[$key] = $filter;
		}

		return $this;
	}
386239
public function filter(array $filters)
	{
		foreach ($filters as $filter) {
			if ($filter->isValueSet()) {
				if ($filter->hasConditionCallback()) {
					$data = (array) call_user_func_array(
						$filter->getConditionCallback(),
						[$this->data, $filter->getValue()]
					);
					$this->setData($data);
				} else {
					$data = array_filter($this->data, function ($row) use ($filter) {
						return $this->applyFilter($row, $filter);
					});
					$this->setData($data);
				}
			}
		}

		return $this;
	}
999307
public static policypatset[] get_filtered(nitro_service service, filtervalue[] filter) throws Exception{
		policypatset obj = new policypatset();
		options option = new options();
		option.set_filter(filter);
		policypatset[] response = (policypatset[]) obj.getfiltered(service, option);
		return response;
	}
1336104
public function setFilterable($filterable = true)
    {
        foreach ($this->results as $name) {
            $this->columns->offsetGet($name)->setFilterable($filterable);
        }

        return $this;
    }
897133
public static function get($property, $collection)
    {
        if (false === self::isValid($collection)) {
            return [];
        }

        $getter = sprintf('get%s', ucfirst($property));
        $result = [];
        foreach ($collection as $entity) {
            $function = [
                $entity,
                $getter
            ];

            if (false === is_callable($function)) {
                throw new LogicException('Missing getter');
            }

            $result[] = $entity->$getter();
        }

        return $result;
    }
393913
function reduceSet(set) {
  return set.map(member => member && member.uri).filter(Boolean)
}
1083891
public function fetchSet($condition = array())
    {
        $query = self::getInstance($this, $condition);

        return $this->getRepository()->fetch($query, AnDomain::FETCH_ENTITY_SET);
    }
125581
public function filter(
        GitChangeSet $gitChangeSet,
        string $filter = '',
        string $blacklistToken = '',
        string $whitelistToken = ''
    ) {
        $whitelist = [];
        $deDuped = true;

        if ($whitelistToken !== '') {
            $deDuped = false;
            $whitelist = $this->blacklistFactory->findTokenDirectories($whitelistToken);
        }
        $blacklist = $this->blacklistFactory->build($blacklistToken, $deDuped);

        $list = $this->mergeLists($blacklist, $whitelist);
        $files = $gitChangeSet->getFiles();

        $result = $this->iterateOverFiles($filter, $files, $list);

        $gitChangeSet->setFiles($result);
    }
745871
private function applyFilters($filters = [], $returnCount = false)
    {
        $result = null;
        // Convert our filters into a query.
        if ($filters) {
            $alias = $this->getTableAlias();
            $query = $this->getEntityManager()->getConnection()->createQueryBuilder();
            if ($returnCount) {
                $query->select('COUNT(*)');
            } else {
                // Selecting only the id and contact_id for covering index benefits.
                $query->select($alias.'.id, '.$alias.'.contact_id');
                $query->setMaxResults(1);
            }
            $query->from(MAUTIC_TABLE_PREFIX.$this->getTableName(), $alias);

            foreach ($filters as $k => $set) {
                // Expect orx, anx, or neither.
                if (isset($set['orx'])) {
                    if (count($set['orx'])) {
                        $expr = $query->expr()->orX();
                    }
                    $properties = $set['orx'];
                } elseif (isset($set['andx'])) {
                    if (count($set['andx'])) {
                        $expr = $query->expr()->andX();
                    }
                    $properties = $set['andx'];
                } else {
                    $expr       = $query->expr();
                    $properties = $set;
                }
                if (isset($expr)) {
                    foreach ($properties as $property => $value) {
                        if (is_array($value)) {
                            $expr->add(
                                $query->expr()->in($alias.'.'.$property, $value)
                            );
                        } else {
                            $expr->add(
                                $query->expr()->eq($alias.'.'.$property, ':'.$property.$k)
                            );
                            $query->setParameter($property.$k, $value);
                        }
                    }
                }
                if (isset($set['date_added'])) {
                    $query->add(
                        'where',
                        $query->expr()->andX(
                            $query->expr()->gte($alias.'.date_added', 'FROM_UNIXTIME(:dateAdded'.$k.')'),
                            (isset($expr) ? $expr : null)
                        )
                    );
                    $query->setParameter('dateAdded'.$k, (int) $set['date_added']);
                }
                $result = $query->execute()->fetch();
                if ($returnCount) {
                    $result = intval(reset($result));
                }
            }
        }

        return $result;
    }
927900
public function filter($collection = null, $iterator = null)
    {
        $return = array();
        foreach ($collection as $val) {
            if (call_user_func($iterator, $val)) {
                $return[] = $val;
            }
        }
        return $return;
    }