Filters each descriptor, validates them, stores the validation results and returns a collection of transmuted
objects.

@param DescriptorAbstract[] $descriptor

@return Collection
978107
private function filterAndValidateEachDescriptor($descriptor)
    {
        $descriptors = new Collection();
        foreach ($descriptor as $key => $item) {
            $item = $this->filterAndValidateDescriptor($item);
            if (!$item) {
                continue;
            }

            $descriptors[$key] = $item;
        }

        return $descriptors;
    }
230027
protected function pipe(callable $validator) : ValidatorAbstract
    {
        $that = clone $this; // Immutability!
        array_push($that->restrictions, $validator);

        return $that;
    }
673118
public static function inferDescriptor($descriptor)
    {
        if (isset($descriptor->type) && $descriptor->type == static::type()) {
            return new static($descriptor);
        } else {
            return false;
        }
    }
802291
protected function mapReflectorToDescriptor($reflector, $descriptor)
    {
        $descriptor->setFullyQualifiedStructuralElementName($reflector->getName() . '()');
        $descriptor->setName($reflector->getShortName());
        $descriptor->setVisibility($reflector->getVisibility() ? : 'public');
        $descriptor->setFinal($reflector->isFinal());
        $descriptor->setAbstract($reflector->isAbstract());
        $descriptor->setStatic($reflector->isStatic());
        $descriptor->setLine($reflector->getLinenumber());
    }
170741
protected function mapReflectorToDescriptor(Method $reflector, MethodDescriptor $descriptor): void
    {
        $descriptor->setFullyQualifiedStructuralElementName($reflector->getFqsen());
        $descriptor->setName($reflector->getName());
        $descriptor->setVisibility((string) $reflector->getVisibility() ?: 'public');
        $descriptor->setFinal($reflector->isFinal());
        $descriptor->setAbstract($reflector->isAbstract());
        $descriptor->setStatic($reflector->isStatic());
        $descriptor->setLine($reflector->getLocation()->getLineNumber());
        $descriptor->setReturnType($reflector->getReturnType());
    }
1176016
protected function get(RequestDescriptor $descriptor)
    {
        return new Request(
            $descriptor->getMethod(),
            $descriptor->getUrl(),
            $descriptor->getHeaders()
        );
    }
1055274
protected function renderChildren(Descriptor $descriptor) {
		$counter = 1;
		$parts   = [];
		$total   = $descriptor->getChildrenNumber();
		
		$tagsLocator = $this->getTagsLocator();
		$linkUp      = $tagsLocator->linkUp->render();
		$linkDown    = $tagsLocator->linkDown->render();
		$wrapper     = $tagsLocator->wrapper;
		
		foreach ($descriptor as $linkTitle => $child) {
			$element = $this->renderChildElement($child, $linkTitle);
			
			if ($counter > 1) {
				$element .= $linkUp;
			}
			
			if ($counter < $total) {
				$element .= $linkDown;
			}
			
			if ($total > 1) {
				$element = $wrapper->render($element);
			}
			
			$parts[] = $element;
			
			++ $counter;
		}
		
		return $wrapper->render(implode('<br>', $parts));
	}
1034739
public function getFiltersArrayItem($filterIdentifier)
    {
        return isset($this->filtersArray[$filterIdentifier]) ? $this->filtersArray[$filterIdentifier] : false;
    }
733112
public function build(PageDocumentDescriptor $descriptor)
    {
        if (IndexibleVoterInterface::VOTE_DENY === $this->indexibleVoter->isIndexible($descriptor)) {
            return null;
        }

        $document = $this->createDocument();

        $this->mapper->mapDocument($document, $descriptor);

        $event = new MapDocumentEvent($document, $descriptor);
        $this->dispatcher->dispatch(IndexerPageEvents::MAP_DOCUMENT, $event);

        return $document;
    }
880820
public function getDescriptor()
    {
        if (is_null($this->_descriptor)) {
            $this->_descriptor = new Descriptor(
                [
                    'descriptor' => Manager::getInstance()
                        ->get($this->getModelName())
                ]
            );
        }
        return $this->_descriptor;
    }
903854
public function filteringScenarios()
    {
        $scenarios = [ActiveRecord::SCENARIO_DEFAULT => []];
        foreach ($this->getFilterValidators() as $validator) {
            foreach ($validator->on as $scenario) {
                $scenarios[$scenario] = [];
            }
            foreach ($validator->except as $scenario) {
                $scenarios[$scenario] = [];
            }
        }
        $names = array_keys($scenarios);

        foreach ($this->getFilterValidators() as $validator) {
            if (empty($validator->on) && empty($validator->except)) {
                foreach ($names as $name) {
                    foreach ($validator->attributes as $attribute) {
                        $scenarios[$name][$attribute] = true;
                    }
                }
            } elseif (empty($validator->on)) {
                foreach ($names as $name) {
                    if (!in_array($name, $validator->except, true)) {
                        foreach ($validator->attributes as $attribute) {
                            $scenarios[$name][$attribute] = true;
                        }
                    }
                }
            } else {
                foreach ($validator->on as $name) {
                    foreach ($validator->attributes as $attribute) {
                        $scenarios[$name][$attribute] = true;
                    }
                }
            }
        }

        foreach ($scenarios as $scenario => $attributes) {
            if (!empty($attributes)) {
                $scenarios[$scenario] = array_keys($attributes);
            }
        }

        foreach ([ActiveRecord::SCENARIO_CREATE, ActiveRecord::SCENARIO_UPDATE] as $scenario) {
            if (!isset($scenarios[$scenario])) {
                $scenarios[$scenario] = $scenarios[ActiveRecord::SCENARIO_DEFAULT];
            }
        }
        return $scenarios;
    }
664225
public static function hydrateCollection(array $validators)
    {
        $hydrated = [];

        foreach ($validators as $validator) {
            $hydrated[] = self::hydrate($validator);
        }

        return $hydrated;
    }
1330677
private function _createNamespaceName($descriptor)
    {
        if (isset($this->customArguments['namespace'])) {
            return $this->customArguments['namespace'];
        }

        $t = $descriptor->getClass();
        $t = explode("\\", $t);
        array_pop($t);
        $name = implode("\\", $t);
        return $name;
    }
688095
public function getFilters($to_array = true) {
		if ($to_array === true) {
			return $this->filters->toArray();
		}

		return $this->filters;
	}
46274
public function collection() : EmbeddedCollectionDefiner
    {
        return new EmbeddedCollectionDefiner(
            $this->orm,
            function (callable $mapperLoader, $tableName, $primaryKeyName, $foreignKeyName) {
                call_user_func($this->callback, function (
                    $idString,
                    Table $parentTable,
                    IObjectMapper $parentMapper
                ) use (
                    $mapperLoader,
                    $tableName,
                    $primaryKeyName,
                    $foreignKeyName
                ) {
                    return new EmbeddedCollectionRelation(
                        $idString,
                        $mapperLoader($parentMapper),
                        $parentTable->getName(),
                        $this->orm->getNamespace() . $tableName,
                        $parentTable->getPrimaryKeyColumn()->withName($primaryKeyName),
                        new Column($foreignKeyName, PrimaryKeyBuilder::primaryKeyType()),
                        $parentTable->getPrimaryKeyColumn()
                    );
                });
            }
        );
    }
998004
protected function renderHeaderContent(Descriptor $descriptor) {
		$tagsLocator = $this->getTagsLocator();
		
		$title = '';
		
		if ($descriptor->hasLabel()) {
			$label  = htmlspecialchars($descriptor->getLabel());
			$title .= $tagsLocator->label->render($label);
		}
		
		$title .= htmlspecialchars($descriptor->getTitle());
		
		if ($descriptor->hasBadge()) {
			$badge  = htmlspecialchars($descriptor->getBadge());
			$title .= $tagsLocator->badge->render($badge);
		}
		
		return $tagsLocator->header->render($title);
	}
957988
public function desc(array $collection)
    {
        $this->changeDirection(false);
        $collection = $this->asc($collection);
        $this->changeDirection(true);
        return $collection;
    }