Wraps the given Descriptor inside a Collection Descriptor of type array and returns that.

@param DescriptorAbstract $descriptor

@return CollectionDescriptor
343656
protected function convertToArrayDescriptor($descriptor)
    {
        $arrayDescriptor = new CollectionDescriptor('array');
        $arrayDescriptor->setTypes(array($descriptor));
        $arrayDescriptor->setKeyTypes(array('mixed'));

        return $arrayDescriptor;
    }
1359111
public static function resource($descriptor, $basePath = null, $skipValidations = false)
    {
        $resourceClass = static::getResourceClass($descriptor);
        $resource = new $resourceClass($descriptor, $basePath, $skipValidations);

        return $resource;
    }
167105
protected function renderElement(Descriptor $descriptor) {
		$element = $this->renderElementInner($descriptor);
		
		if ($descriptor->hasChildren()) {
			$tagsLocator = $this->getTagsLocator();
			
			$children = $this->renderChildren($descriptor);
			$element  = $tagsLocator->link->render() . $element;
			
			return $children . $tagsLocator->wrapper->render($element);
		}
		
		return $element;
	}
1235383
public static <T extends ByteCodeElement> ElementMatcher.Junction<T> hasDescriptor(String descriptor) {
        return new DescriptorMatcher<T>(new StringMatcher(descriptor, StringMatcher.Mode.EQUALS_FULLY));
    }
1370098
public function addExtractor(ExtractorInterface $extractor): self
    {
        switch (true) {
            case $extractor instanceof MultiStringExtractorInterface:
            case $extractor instanceof StringExtractorInterface:
                $this->extractors[$extractor->name()] = $extractor;
                return $this;
            default:
        }

        throw new \InvalidArgumentException('Unknown extractor type ' . \get_class($extractor));
    }
872890
private function _createClass(
        Descriptor $descriptor, FileDescriptor $file)
    {
        foreach ($descriptor->getEnumType() as $enum) {
            $this->_createEnum($enum, $file);
        }

        /** @var Descriptor $nested */
        foreach ($descriptor->getNestedType() as $i => $nested) {
            if (!$nested->isMapEntry()) {
                $this->_createClass($nested, $file);
            }
        }

        /**
         * namespace & use
         */
        $buffer = new CodeStringBuffer(self::TAB, self::EOL);
        $this->_createFileComment($file, $buffer);
        $buffer->newline();

        $namespaceName = $this->_createNamespaceName($descriptor);
        if ($namespaceName) {
            $buffer->append('namespace ' . $namespaceName . ';')->newline();
        }
        $buffer->append('use Google\Protobuf\Internal\GPBType;');
        $buffer->append('use Google\Protobuf\Internal\RepeatedField;');
        $buffer->append('use Google\Protobuf\Internal\GPBUtil;');
        $buffer->newline();

        /**
         * class comment
         */
        $comment = new CommentStringBuffer(self::TAB, self::EOL);
        $path = $this->_createEmbeddedMessagePath($descriptor);
        if ($path) {
            $comment->append($descriptor->getFullName() . ' message embedded in ' . $path . ' message');
        } else {
            $comment->append($descriptor->getFullName() . ' message');
        }


        $location = $file->getSourceCodeLocation($descriptor);
        if (!$location) {
            throw  new \Exception("cannot find source code location:" . $descriptor->getFullName()
                . " path: " . implode(", ", $descriptor->getSourceCodePath()));
        }
        if ($location->getLeadingComments()) {
            $comment->append($location->getLeadingComments());
        }
        if ($location->getTrailingComments()) {
            $comment->append($location->getTrailingComments());
        }
        $buffer->append($comment);

        /**
         * class name
         */
        $fullName = $this->_createClassName($descriptor);
        $shortName = $this->getClassShortName($fullName);
        $baseMessage = $this->customArguments['base_message'] ?? '';
        if (!$baseMessage) {
            $baseMessage = '\Google\Protobuf\Internal\Message';
        }
        $buffer->append("class $shortName extends $baseMessage")
            ->append('{')
            ->incrIndentation();

        $this->_createClassBody($descriptor->getField(), $buffer, $file);

        $buffer->decrIndentation()
            ->append('}');

        $this->generateClass($shortName, $namespaceName, $buffer);
    }
358456
protected function renderElementInner(Descriptor $descriptor) {
		$tagsLocator = $this->getTagsLocator();
		
		// Element's main
		$elementTag = new Tag();
		$elementTag->addClass('topology-element');
		
		$type = $descriptor->getType();
		
		if (isset(static::$types[$type])) {
			$elementTag->addClass(static::$types[$type]);
		}
		
		// Header
		$elementTag->appendHtml($this->renderHeaderContent($descriptor));
		
		// Body
		if ($descriptor->hasPropertities()) {
			$content = $this->renderBodyContent($descriptor);
			$elementTag->appendHtml($tagsLocator->body->render($content));
		} else {
			$elementTag->appendHtml($tagsLocator->body->render());
		}
		
		// Footer
		$elementTag->appendHtml($tagsLocator->footer->render());
		
		return $elementTag->render();
	}
104093
public static function validate($descriptor)
    {
        try {
            new static($descriptor);

            return [];
        } catch (Exceptions\SchemaLoadException $e) {
            return [
                new SchemaValidationError(SchemaValidationError::LOAD_FAILED, $e->getMessage()),
            ];
        } catch (Exceptions\SchemaValidationFailedException $e) {
            return $e->validationErrors;
        }
    }
795540
public function create($data)
    {
        $collection = new DescriptorCollection();

        foreach ($data as $type) {
            $collection->add($this->createDescriptorForType($type));
        }

        return $collection;
    }
880820
public function getDescriptor()
    {
        if (is_null($this->_descriptor)) {
            $this->_descriptor = new Descriptor(
                [
                    'descriptor' => Manager::getInstance()
                        ->get($this->getModelName())
                ]
            );
        }
        return $this->_descriptor;
    }
417551
public function hasDescriptor($descriptor, $value = null)
    {
        $this->loadDescriptors();

        $exists = array_key_exists($descriptor, $this->descriptors);

        if (false === $exists) {
            return false;
        }

        if (null === $value) {
            return true;
        }

        $descriptorValue = $this->descriptors[$descriptor];

        // normalize
        if ($descriptorValue === 'true') {
            $descriptorValue = true;
        }
        if ($descriptorValue === 'false') {
            $descriptorValue = false;
        }

        if ($value === $descriptorValue) {
            return true;
        }

        return false;
    }
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()
                    );
                });
            }
        );
    }
1190942
public function addExtractor(ExtractorInterface $extractor): self
    {
        $this->extractors[$extractor->name()] = $extractor;

        return $this;
    }
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));
	}
1056768
private function getDescriptor()
    {
        if (!is_object($this->descriptor)) {
            $descriptorClass = '\\ntentan\\atiaa\\descriptors\\'.ucfirst($this->config['driver']).'Descriptor';
            $this->descriptor = new $descriptorClass($this);
        }

        return $this->descriptor;
    }
91073
protected function finderWrapperInject($finder)
    {
        foreach ($this->wrappedMethodHistory as $row) {
            call_user_func_array(array($finder, $row['method']), $row['args']);
        }
    }
1027575
public function set($key, $value)
    {
        if (! $value instanceof EntityDescriptorInterface) {
            throw new InvalidArgumentException (
                "Invalid descriptor. DescriptorsCollection only accepts ".
                "EntityDescriptorInterface object."
            );
        }
        return parent::set($key, $value);
    }