Return all children recursively
@param  ContextSpecificationInterface $filter
@return array
973452
public function getChildrenRecursively (ContextSpecificationInterface $filter = null)
	{
		$list = $this->getChildren($filter);

		foreach ($this->getChildren() as $child)
		{
			if ($child->hasChildren())
			{
				$list = array_merge ($list, $child->getChildrenRecursively($filter));
			}
		}

		return $list;
	}
1223308
public function iterator($filter = null){
        $ret = new Iterator($this, $this->vo);
        $ret->setCloneVo($this->toCloneVo);
        $this->setupIteratorRelations($ret);
        $ret->setRoot();

        if ($filter != null){
            $ret = new Filter($ret, $filter);
        }
        return $ret;
    }
1070605
public static function get_available_in_context($contexts) {
        $params = self::validate_parameters(self::get_available_in_context_parameters(), array('contexts' => $contexts));
        $filters = $warnings = array();

        foreach ($params['contexts'] as $contextinfo) {
            try {
                $context = self::get_context_from_params($contextinfo);
                self::validate_context($context);
                $contextinfo['contextid'] = $context->id;
            } catch (Exception $e) {
                $warnings[] = array(
                    'item' => 'context',
                    'itemid' => $context['instanceid'],
                    'warningcode' => $e->getCode(),
                    'message' => $e->getMessage(),
                );
                continue;
            }
            $contextfilters = filter_get_available_in_context($context);

            foreach ($contextfilters as $filter) {
                $filters[] = array_merge($contextinfo, (array) $filter);
            }
        }

        return array(
            'filters' => $filters,
            'warnings' => $warnings,
        );
    }
286548
protected static function parseParameterFilter($filter)
	{
		list($name, $parameters) = explode(':', $filter, 2);

		return array($name, explode(',', $parameters));
	}
889699
public function getMethods($filter = null)
    {
        if (!isset($this->methods)) {
            $directMethods = ReflectionMethod::collectFromClassNode($this->classLikeNode, $this);
            $parentMethods = $this->recursiveCollect(function (array &$result, \ReflectionClass $instance, $isParent) {
                $reflectionMethods = [];
                foreach ($instance->getMethods() as $reflectionMethod) {
                    if (!$isParent || !$reflectionMethod->isPrivate()) {
                        $reflectionMethods[$reflectionMethod->name] = $reflectionMethod;
                    }
                }
                $result += $reflectionMethods;
            });
            $methods = $directMethods + $parentMethods;

            $this->methods = $methods;
        }
        if (!isset($filter)) {
            return array_values($this->methods);
        }

        $methods = [];
        foreach ($this->methods as $method) {
            if (!($filter & $method->getModifiers())) {
                continue;
            }
            $methods[] = $method;
        }

        return $methods;
    }
494202
public function &getNonDimensionalRoleRefs( $filter = array(), $sort = true )
	{
		// Make sure the filter is initialized and contains lowercase values
		if ( ! is_array( $filter ) ) $filter = array();
		$filter = array_flip( array_map( 'strtolower', $filter ) );

		$refs = $this->context->nonDimensionalRoleRefs;

		/**
		 * @var array $result
		 */
		$result = array();

		foreach ( $refs as $refKey => $ref )
		{
			// Apply the filter if one is provided
			if ( count( $filter ) && ! isset( $filter[ strtolower( $refKey ) ] ) ) continue;

			$result[ $refKey ] = $this->context->nonDimensionalRoleRefs[ $refKey ];
			foreach ( $result[ $refKey ] as $arcroleKey => $arcrole )
			{
				// If the acrole type is defined, get the cycles allowed otherwise set it to be 'none'
				$arcRoleTaxonomy = $this->getTaxonomyForXSD( $arcrole['href'] );
				$arcRoleRefs = $arcRoleTaxonomy ? $arcRoleTaxonomy->getArcroleTypes() : false;
				if ( $arcRoleRefs && isset( $arcRoleRefs['link:definitionArc'][ $arcroleKey ] ) )
				{
					$arcRoleRef = $arcRoleRefs['link:definitionArc'][ $arcroleKey ];
					$result[ $refKey ][ $arcroleKey ]['text'] = isset( $arcRoleRef['description'] ) ? $arcRoleRef['description'] : "";
					$result[ $refKey ][ $arcroleKey ]['cyclesAllowed'] = isset( $arcRoleRef['cyclesAllowed'] ) ? $arcRoleRef['cyclesAllowed'] : "none";
				}
				else
				{
					$result[ $refKey ][ $arcroleKey ]['text'] = "";
					$result[ $refKey ][ $arcroleKey ]['cyclesAllowed'] = "none";
				}

				// Add the description
				$description = $arcRoleTaxonomy->getNonDimensionalArcRoleDescription( $arcroleKey );
				$result[ $refKey ][ $arcroleKey ]['text'] = $description ? $description : "";

				// Remove any prohibited arcs
				if ( isset( $result[ $refKey ][ $arcroleKey ]['arcs'] ) && count( $result[ $refKey ][ $arcroleKey ]['arcs'] ) )
				{
					$arcs =& $result[ $refKey ][ $arcroleKey ]['arcs'];
					foreach ( $arcs as $from => $targets )
					{
						foreach ( $targets as $to => $node )
						{
							if ( $node['use'] == XBRL_Constants::$xlinkUseOptional ) continue;
							unset( $arcs[ $from ][ $to ] );
						}

						if ( count( $arcs[ $from ] ) ) continue;
						unset( $arcs[ $from ] );
					}
				}
			}

			if ( $sort )
			{
				$this->sortRoleRefs( $result[ $refKey ] );
			}

		}

		return $result;
	}
753024
public function listResources($filter)
    {
        $alias = 'resource';
        $collection = $this->getThisCollection();

        $queryBuilder = $this->getRepository()
            ->createQueryBuilder($alias);

        // Build the filter on resources
        $this->filterQueryBuilder($queryBuilder, $filter, $collection, $alias);

        // Count the total number of resources
        $countQueryBuilder = clone $queryBuilder;
        $collectionIdentifier = $collection->getIdentifier();
        $totalNumberOfRows = $countQueryBuilder
            ->select($countQueryBuilder->expr()->count($alias . '.' . $collectionIdentifier))
            ->getQuery()
            ->getSingleScalarResult();

        // Paginate resources
        $this->paginateQueryBuilder($queryBuilder, $filter);

        // Finally, select all fields
        $queryBuilder->select($alias);

        $returnedResources = $this->loadResourcesFromQueryBuilder($queryBuilder, $this->getThisCollection());

        return Resource::formatResourcesJsonApi($returnedResources, $totalNumberOfRows);
    }
1067510
public static function filters($context, $method)
    {
        $ref = static::_ref($context, $method);

        if (isset(static::$_cachedFilters[$ref])) {
            return static::$_cachedFilters[$ref];
        }

        $filters = isset(static::$_filters[$ref]) ?  static::$_filters[$ref] : [];

        if (is_object($context)) {
            $class = get_class($context);
        } elseif (!$class = get_parent_class($context)) {
            return $filters;
        }

        do {
            $parentRef = $class . "::{$method}";
            if (!isset(static::$_filters[$parentRef])) {
                continue;
            }
            $filters = array_merge($filters, static::$_filters[$parentRef]);
        } while ($class = get_parent_class($class));

        return static::$_cachedFilters[$ref] = $filters;
    }
737165
protected function getPredicatesFromFilterCondition($filter)
    {
        $predicates = [];
        $regex = "/(^|\b)(\w+\:\w+)\.(l|u)(\b|$)/";
        foreach($filter as $key=>$condition)
        {
            if(is_string($key))
            {
                $numMatches = preg_match_all($regex, $key, $matches);
                for($i = 0; $i < $numMatches; $i++)
                {
                    if(isset($matches[2][$i]))
                    {
                        $predicates[] = $matches[2][$i];
                    }
                }
            }
            if(is_string($condition))
            {
                $numMatches = preg_match_all($regex, $condition, $matches);
                for($i = 0; $i < $numMatches; $i++)
                {
                    if(isset($matches[2][$i]))
                    {
                        $predicates[] = $matches[2][$i];
                    }
                }
            }
            elseif(is_array($condition))
            {
                array_merge($predicates, $this->getPredicatesFromFilterCondition($condition));
            }
        }
        return $predicates;
    }
741266
public function getFilteredOptions(string $filter) : array
    {
        $options = call_user_func($this->fieldOptionsLoader, $filter);
        return (new ArrayFieldOptions($options))->getAll();
    }
945453
public function getByKey(string $key, AbstractFilter $filter = null)
    {
        return $this->children->getByKey($key, $filter);
    }
1200460
public function getMethods($filter = -1)
    {
        $return = parent::getMethods($filter);
        foreach ($return as $key => $val) {
            $return[$key] = new ReflectionMethod($this->getName(), $val->getName());
        }

        return $return;
    }
1173558
public function findAll($re, $filter = null) {
        if ($this->isEmpty()) {
            return self::getEmptyContext();
        }

        if (!preg_match_all($re, $this->toString(), $matches, PREG_SET_ORDER)) {
            $matches = array();
        }

        $result = array();
        foreach ($matches as $match) {
            $context = new self($match);
            if (!$filter || $filter($context)) {
                $result[] = $match;
            }
        }

        return new ContextCollection($result);
    }
24197
public function listFiles( $filter = NULL ) : array
    {
        $path = $this->path;

        if ( !file_exists($path) )    return NULL;

        if ( !is_readable($path) )    return NULL;

        if ( is_file($path) )    return NULL;

        $files = array();

        $dh = opendir($path);
        while( ($file_name = readdir($dh)) !== FALSE ){
            if ( $file_name === '.' || $file_name === '..' ){
                continue;
            }
            $file = new File( $file_name, $this );
            if ( $filter ){
                if ( $filter instanceof FileFilterInterface ){
                    if ( $filter->accept($file) ){
                        $files[] = $file;
                    }
                }
                else if ( is_callable($filter) ){
                    if ( $filter($file) ){
                        $files[] = $file;
                    }
                }
            }
            else{
                $files[] = $file;
            }
        }
        return $files;
    }
106486
protected function collectMethods($instance, $filter = ReflectionMethod::IS_PUBLIC)
    {
        static $methodsCache = null;

        if (null === $methodsCache) {
            $methodsCache = $instance
                ? (new ReflectionClass($instance))->getMethods($filter)
                : [];
        }

        return $methodsCache;
    }
697667
public function getAll($filter = null)
    {
        $filters = array('all', 'sales', 'purchase', 'inactive');
        if (!in_array($filter, $filters)) {
            $message = 'Unknown filter "' . $filter . '" for TaxRates';
            $message .= '; available filters: ' . implode(', ', $filters);
            throw new InvalidFilterException($message);
        }

        $rates = new ArrayObject;
        foreach ($this->connector->getAll(__NAMESPACE__) as $rate) {
            if (($filter == 'inactive' && $rate->active) || ($filter != 'inactive' && !$rate->active)) {
                continue;
            }
            if ($filter == 'sales' && $rate->taxRateType != TaxRate::RATE_TYPE_SALES) {
                continue;
            } elseif ($filter == 'purchase' && $rate->taxRateType != TaxRate::RATE_TYPE_PURCHASE) {
                continue;
            }
            $rates->append($rate);
        }
        return $rates;
    }
606587
public function getEAVAttributes(FilterInterface $filter): array
    {
        return $this->filterHelper->getEAVAttributes($this->getFamily(), $filter->getAttributes());
    }