Creates a listing using given filters.

@TODO: Support complex filtering over multiple machine types and make
'type' filter optional.

@see AbstractBackend::createListing()
514655
protected function createListing(Smalldb $smalldb, $filters, $filtering_flags = 0): IListing
	{
		$type = $filters['type'];
		$machine = $this->getMachine($smalldb, $type);
		if ($machine === null) {
			throw new InvalidArgumentException('Machine type "'.$type.'" not found.');
		}

		// Do not confuse machine-specific filtering
		unset($filters['type']);

		return $machine->createListing($filters, $filtering_flags);
	}
672322
protected function setupFilterShortcuts()
    {
        foreach (self::$filters as $filterSubject => $availableFilters) {
            $filterArrayName = $filterSubject . 'Filter';
            $this->$filterArrayName = [];
            $tempArr = &$this->$filterArrayName;
            foreach ($availableFilters as $type) {
                $funcName = 'make' . ucfirst($filterSubject) . 'Filter' . $type;
                $tempArr[$type] = function () use ($funcName) {
                    return call_user_func_array([$this, $funcName], func_get_args());
                };
            }
        }
    }
880165
static function createClassFilteringSQLString( $classFilterType, &$classFilterArray )
    {
        // Check for class filtering
        $classCondition = '';

        if ( isset( $classFilterType ) &&
             ( $classFilterType == 'include' || $classFilterType == 'exclude' ) &&
             count( $classFilterArray ) > 0 )
        {
            $classCondition = '  ';
            $i = 0;
            $classCount = count( $classFilterArray );
            $classIDArray = array();
            foreach ( $classFilterArray as $classID )
            {
                $originalClassID = $classID;
                // Check if classes are recerenced by identifier
                if ( is_string( $classID ) && !is_numeric( $classID ) )
                {
                    $classID = eZContentClass::classIDByIdentifier( $classID );
                }
                if ( is_numeric( $classID ) )
                {
                    $classIDArray[] = $classID;
                }
                else
                {
                    eZDebugSetting::writeWarning( 'kernel-content-class', "Invalid class identifier in subTree() classfilterarray, classID : " . $originalClassID );
                }
            }

            if ( count( $classIDArray ) > 0  )
            {
                $classCondition .= " ezcontentobject.contentclass_id ";
                if ( $classFilterType == 'include' )
                    $classCondition .= " IN ";
                else
                    $classCondition .= " NOT IN ";

                $classIDString =  implode( ', ', $classIDArray );
                $classCondition .= ' ( ' . $classIDString . ' ) AND';
            }
            else
            {
                if ( count( $classIDArray ) == 0 and count( $classFilterArray ) > 0 and $classFilterType == 'include' )
                {
                    $classCondition = false;
                }
            }
        }

        return $classCondition;
    }
289829
public Filter createFilter(FilterFactoryParams params) throws FilterNotCreatedException {
        try {
            return createFilter(parseCategories(params.getArgs()));
        } catch (ClassNotFoundException e) {
            throw new FilterNotCreatedException(e);
        }
    }
1005698
private function createFromList($list)
    {
        $instance = new FileBag;

        foreach (array_keys($list['name']) as $key) {
            $params = [
                'name'      => $list['name'][$key],
                'type'      => $list['type'][$key],
                'tmp_name'  => $list['tmp_name'][$key],
                'error'     => $list['error'][$key],
                'size'      => $list['size'][$key],
            ];
            $file = $this->uploadedFileBuilder->create($params);
            $instance[] = $file;
        }

        return $instance;
    }
324246
function() {
        // Initialize category filters
        this._categoryFilters = [];
        var aInitialCategories = Logger.categories;

        for(var j=0; j < aInitialCategories.length; j++) {
            var sCategory = aInitialCategories[j];

            // Add category to the internal array of filters
            this._categoryFilters.push(sCategory);

            // Add checkbox element if UI is enabled
            if(this._elCategoryFilters) {
                this._createCategoryCheckbox(sCategory);
            }
        }
    }
493803
public function listFilesWithType(string $type, array $filter = null, array $sortOrder = null, array $limit = null) {
		$timeStamp = microtime(true);
	    $typeOpts = array('a', 'i', 'v', 'f', 'd', 'p', 's', 'c');
        if(!in_array($type, $typeOpts)){
	        throw new InvalidFileTypeException($type);
		}
        $filter[] = array(
            'glue' => ' and',
            'condition' => array(
                'column' => $this->entity['f']['alias'] . '.type',
                'comparison' => '=',
                'value' => $type)
        );
        $response = $this->listFiles($filter, $sortOrder, $limit);

		$response->stats->execution->start = $timeStamp;
		$response->stats->execution->end = microtime(true);

		return $response;
    }
1078701
public function createFilterDriver()
	{
		$aliases = $this->app['config']->get('basset.aliases.filters', array());

		$node = $this->app['config']->get('basset.node_paths', array());

		$filter = new FilterFactory($aliases, $node, $this->app['env']);

		return $this->factory($filter);
	}
616254
public function makeTwigFilters($filters = [])
    {
        if (!is_array($filters)) {
            $filters = [];
        }

        foreach ($this->listFilters() as $name => $callable) {

            /*
             * Handle a wildcard function
             */
            if (strpos($name, '*') !== false && $this->isWildCallable($callable)) {
                $callable = function ($name) use ($callable) {
                    $arguments = array_slice(func_get_args(), 1);
                    $method = $this->isWildCallable($callable, Str::camel($name));
                    return call_user_func_array($method, $arguments);
                };
            }

            if (!is_callable($callable)) {
                throw new ApplicationException(sprintf('The markup filter for %s is not callable.', $name));
            }

            $filters[] = new Twig_SimpleFilter($name, $callable, ['is_safe' => ['html']]);
        }

        return $filters;
    }
1199970
protected function createQuery()
    {
        if (!$this->queryCreated) {
            $this->setBaseQuery();
            if (!isset($this->showInactiveUsers)) {
                $this->filter('u.uIsActive', 1);
            }
            if (!$this->showInvalidatedUsers) {
                $this->filter('u.uIsValidated', 0, '!=');
            }
            $this->setupAttributeFilters("left join UserSearchIndexAttributes on (UserSearchIndexAttributes.uID = u.uID)");
            $this->queryCreated = 1;
        }
    }
109762
public function createFilter($componentId = null, FilterInterface $filter = null, $persistent = false)
    {
        if (!\is_null($filter)) {
            $filterData = $this
                ->displayCriteriaReader
                ->readAttribute(DisplayCriteriaReader::FILTER, null, $componentId, $persistent);

            $clearFilter = null !== $filterData && isset($filterData['clearFilter']);
            $defaultFilter = null !== $filterData && isset($filterData['defaultFilter']);

            // reset rules (this removes defaults from them)
            if (!$defaultFilter && ($clearFilter || null !== $filterData)) {
                foreach ($filter as $rule) {
                    $rule->reset();
                }
            }

            // reset filter data
            if (null === $filterData || $clearFilter || $defaultFilter) {
                $filterData = [];
            }

            // make filter data empty if the filters are cleared
            if ($clearFilter) {
                $this->displayCriteriaReader->clearAttribute(DisplayCriteriaReader::FILTER, $componentId, []);
            }

            // unset filter data if defaults are requested
            if ($defaultFilter) {
                $this->displayCriteriaReader->clearAttribute(DisplayCriteriaReader::FILTER, $componentId, null);
            }

            $form = $this->formFactory->createNamed('filter', FilterType::class, $filter, [
                'filter' => $filter,
                'translation_domain' => $filter->getTranslationDomain(),
            ]);
            $form->submit($filterData, false);

            $filter = $form->getData();
            $filter->setForm($form);

            return $filter;
        }

        return new Filter();
    }
922013
public function create($filterTypeAlias, $name = null, array $options = [])
    {
        $alias = strtolower($filterTypeAlias);

        if (!$this->filterChain->hasType($alias)) {
            throw new FilterCreatorException(sprintf('Given filter type alias "%s" does not exist.', $alias));
        }


        /** @var FilterInterface $filter */
        $filter = clone $this->filterChain->getType($alias);

        if (!($filter instanceof FilterInterface)) {
            // The filter must implement the bundles FilterInterface.
            throw new FilterCreatorException(sprintf(
                'Filter "%s" must implement Da2e\FiltrationBundle\Filter\Filter\FilterInterface interface.',
                get_class($filter)
            ));
        }

        $filter->setName($name === null ? $this->generateUniqueName($alias) : $name);

        if (count($options) > 0) {
            // Handle filter options if there are such.
            $this->filterOptionHandler->handle($filter, $options);
        }

        return $filter;
    }
1323999
public function objectsList($filter = null, $params = null)
    {
        //====================================================================//
        // Stack Trace
        Splash::log()->trace();

        //====================================================================//
        // Prepare Query Builder
        /** @var QueryBuilder $queryBuilder */
        $queryBuilder = $this->repository->createQueryBuilder('c');
        // Setup Results Offset
        if (isset($params['offset']) && is_int($params['offset'])) {
            $queryBuilder->setFirstResult($params['offset']);
        }
        // Limit Results Number
        if (isset($params['max']) && is_int($params['max'])) {
            $queryBuilder->setMaxResults($params['max']);
        }

        //====================================================================//
        // Add List Filters
        if (!empty($filter)) {
        }

        //====================================================================//
        // Load Objects List
        $rawData = $queryBuilder->getQuery()->getResult();

        //====================================================================//
        // Parse Data on Result Array
        $response = array();
        foreach ($rawData as $object) {
            $response[] = $this->getObjectListArray($object);
        }

        //====================================================================//
        // Parse Meta Infos on Result Array
        $response['meta'] = array(
            'total' => count($rawData),
            'current' => $this->getTotalCount(),
        );

        //====================================================================//
        // Return result
        return $response;
    }
523476
private function createList($listId, $listParameters)
    {
        $providerServiceKey = $listParameters['subscriber_provider'];
        $provider = $this->providerFactory->create($providerServiceKey);
        $subscriberList = new SubscriberList($listId, $provider, $listParameters['merge_fields']);
        $subscriberList->setWebhookUrl($listParameters['webhook_url']);
        $subscriberList->setWebhookSecret($listParameters['webhook_secret']);

        return $subscriberList;
    }
2764
public function createFilteringInterface()
    {
        //Check if section has filtering enabled
        $context = $this->getContext();
        $handle = $context['section_handle'];
        $section_id = SectionManager::fetchIDFromHandle($handle);
        $section = SectionManager::fetch($section_id);
        $filter = $section->get('filter');
        $count = EntryManager::fetchCount($section_id);

        if ($filter !== 'no' && $count > 1) {
            $drawer = Widget::Drawer('filtering-' . $section_id, __('Filter Entries'), $this->createFilteringDrawer($section));
            $drawer->addClass('drawer-filtering');
            $this->insertDrawer($drawer);
        }
    }
146721
protected function _createListTerm( $name, $type )
	{
		$sign = null;

		switch( $this->getOperator() )
		{
			case '!=':
				$sign = false;

			case '==':

				$multiterm = new Zend_Search_Lucene_Search_Query_MultiTerm();

				foreach( $this->getValue() as $value )
				{
					$escaped = $this->_escape( $this->getOperator(), SORT_STRING, $value );
					$term = new Zend_Search_Lucene_Index_Term( $this->_empty( $escaped ), $name );
					$multiterm->addTerm( $term, $sign );
				}

				return $multiterm;

			case '~=':

				$query = new Zend_Search_Lucene_Search_Query_Boolean();

				foreach( $this->getValue() as $value )
				{
					$escaped = $this->_escape( $this->getOperator(), SORT_STRING, $value );
					$term = new Zend_Search_Lucene_Index_Term( strtolower( $this->_empty( $escaped ) ) . '*', $name );
					$query->addSubquery( new Zend_Search_Lucene_Search_Query_Wildcard( $term ) );
				}

				return $query;
		}
	}
1252882
protected function createSearchFilter($filter, $value)
    {
        // Field name is always the first component
        $fieldArgs = explode(':', $filter);
        $fieldName = array_shift($fieldArgs);

        // Inspect type of second argument to determine context
        $secondArg = array_shift($fieldArgs);
        $modifiers = $fieldArgs;
        if (!$secondArg) {
            // Use default filter if none specified. E.g. `->filter(['Name' => $myname])`
            $filterServiceName = 'DataListFilter.default';
        } else {
            // The presence of a second argument is by default ambiguous; We need to query
            // Whether this is a valid modifier on the default filter, or a filter itself.
            /** @var SearchFilter $defaultFilterInstance */
            $defaultFilterInstance = Injector::inst()->get('DataListFilter.default');
            if (in_array(strtolower($secondArg), $defaultFilterInstance->getSupportedModifiers())) {
                // Treat second (and any subsequent) argument as modifiers, using default filter
                $filterServiceName = 'DataListFilter.default';
                array_unshift($modifiers, $secondArg);
            } else {
                // Second argument isn't a valid modifier, so assume is filter identifier
                $filterServiceName = "DataListFilter.{$secondArg}";
            }
        }

        // Build instance
        return Injector::inst()->create($filterServiceName, $fieldName, $value, $modifiers);
    }