Creates a Descriptor from the provided data.

@param ClassReflector $data

@return ClassDescriptor
963448
public function create($data)
    {
        $classDescriptor = new ClassDescriptor();

        $classDescriptor->setFullyQualifiedStructuralElementName($data->getName());
        $classDescriptor->setName($data->getShortName());
        $classDescriptor->setPackage($this->extractPackageFromDocBlock($data->getDocBlock()) ?: '');
        $classDescriptor->setLine($data->getLinenumber());
        $classDescriptor->setParent($data->getParentClass());
        $classDescriptor->setAbstract($data->isAbstract());
        $classDescriptor->setFinal($data->isFinal());

        // Reflection library formulates namespace as global but this is not wanted for phpDocumentor itself
        $classDescriptor->setNamespace(
            '\\' . (strtolower($data->getNamespace()) == 'global' ? '' :$data->getNamespace())
        );

        foreach ($data->getInterfaces() as $interfaceClassName) {
            $classDescriptor->getInterfaces()->set($interfaceClassName, $interfaceClassName);
        }

        $fqcn = $classDescriptor->getFullyQualifiedStructuralElementName();
        $namespace = substr($fqcn, 0, strrpos($fqcn, '\\'));
        $classDescriptor->setNamespace($namespace);

        $this->assembleDocBlock($data->getDocBlock(), $classDescriptor);

        $this->addConstants($data->getConstants(), $classDescriptor);
        $this->addProperties($data->getProperties(), $classDescriptor);
        $this->addMethods($data->getMethods(), $classDescriptor);
        $this->addUses($data->getTraits(), $classDescriptor);

        return $classDescriptor;
    }
1241917
public function create($data)
    {
        $descriptor = new VarDescriptor($data->getName());
        $descriptor->setDescription($data->getDescription());
        $descriptor->setVariableName($data->getVariableName());

        $descriptor->setType(AssemblerAbstract::deduplicateTypes($data->getType()));

        return $descriptor;
    }
1192318
public function getClassDescriptor($className) {
		if (!isset($this->classDescriptors[$className])) {
			if (MoufManager::getMoufManager() == null || (MoufManager::getMoufManager()->getScope() == self::SCOPE_APP && $this->getScope() == self::SCOPE_APP)
					|| (MoufManager::getMoufManager()->getScope() == self::SCOPE_ADMIN && $this->getScope() == self::SCOPE_ADMIN)) {
				// We are fully in the scope of the application:
				$this->classDescriptors[$className] = new MoufReflectionClass($className);
			} else {
				$this->classDescriptors[$className] = MoufReflectionProxy::getClass($className, $this->getScope() == self::SCOPE_ADMIN);
			}
		}
		return $this->classDescriptors[$className];
	}
600045
public function create($data)
    {
        $propertyDescriptor = new PropertyDescriptor();
        $propertyDescriptor->setFullyQualifiedStructuralElementName($data->getName());
        $propertyDescriptor->setName($data->getShortName());
        $propertyDescriptor->setVisibility($data->getVisibility() ?: 'public');
        $propertyDescriptor->setStatic($data->isStatic());
        $propertyDescriptor->setDefault($data->getDefault());

        $this->assembleDocBlock($data->getDocBlock(), $propertyDescriptor);
        $propertyDescriptor->setLine($data->getLinenumber());

        return $propertyDescriptor;
    }
1125366
public static function fromData(array $data)
    {
        $reflection = new \ReflectionClass(static::class);
        $instance = $reflection->newInstanceWithoutConstructor();
        $instance->data = $data;
        $instance->jsonUnserialize($data);
        return $instance;
    }
1320744
final public static function deserialize(array $data)
    {
        return Reconstitution::reconstitute()->objectFrom(
            get_called_class(),
            RecursiveSerializer::deserialize($data, self::deserializationCallbacks())
        );
    }
843423
public static function create($data, $class_name)
    {
        if ($data === null) {
            return null;
        }
        if (!is_array($data)) {
            throw new \InvalidArgumentException('data must be an array, given ' . gettype($data));
        }

        if (!class_exists($class_name)) {
            throw new \InvalidArgumentException("class_name {$class_name} cannot found on namespace");
        }

        $output = new $class_name();

        if ($output instanceof SerializableObject) {
            $output->deserializeFromArray($data);
        }

        return $output;
    }
72887
private function createObject(string $className, array $data)
    {
        $repository = $this->objectManager->getRepository($className);

        $object = $repository->create($className);

        if ($object instanceof NotifyPropertyChanged) {
            $object->addPropertyChangedListener($this);
        }

        $this->eventDispatcher->dispatchPreLoad($object, $data);

        $repository->hydrate($object, $data);

        $this->eventDispatcher->dispatchPostLoad($object);

        $this->objectIdentityMap->addToIdentityMap($object, $data);

        return $object;
    }
405892
public function unserialize($data)
    {
        $injector = \Injector::inst();

        $extraData = null;

        if (empty(self::$objectConstructorReflectionMethods[__CLASS__])) {
            self::$objectConstructorReflectionMethods[__CLASS__] = new \ReflectionMethod(__CLASS__, '__construct');
        }

        if (empty(self::$classConfigs[__CLASS__])) {
            self::$classConfigs[__CLASS__] = $injector->getConfigLocator()->locateConfigFor(__CLASS__);
        }

        if ($this instanceof ExtraDataInterface) {
            $unserialized = \Heystack\Core\unserialize($data);

            self::$objectConstructorReflectionMethods[__CLASS__]->invoke(
                $this,
                $unserialized[0]
            );

            $extraData = $unserialized[1];
        } else {
            self::$objectConstructorReflectionMethods[__CLASS__]->invoke(
                $this,
                \Heystack\Core\unserialize($data)
            );
        }

        // Ensure that the spec is loaded for the class
        if (self::$classConfigs[__CLASS__]) {
            $injector->load([__CLASS__ => self::$classConfigs[__CLASS__]]);
        }
        
        $injector->inject($this, __CLASS__);
        
        if ($extraData) {
            $this->setExtraData($extraData);
        }
    }
899015
public function create($data)
    {
        $methodDescriptor = new MethodDescriptor();
        $methodDescriptor->setNamespace(
            substr(
                (string) $data->getFqsen(),
                0,
                -strlen($data->getName()) - 4
            )
        );
        $this->mapReflectorToDescriptor($data, $methodDescriptor);

        $this->assembleDocBlock($data->getDocBlock(), $methodDescriptor);
        $this->addArguments($data, $methodDescriptor);
        $this->addVariadicArgument($data, $methodDescriptor);

        return $methodDescriptor;
    }
471541
protected function createObjectFrom($data)
    {
        $class_name = $this->class_name;

        try {
            return new $class_name($data);
        } catch (\InvalidArgumentException $e) {
            throw new ConverterException(
                sprintf("Unable to create a '%s' instance.", $class_name),
                null,
                $e
            );
        }
    }
562977
private function extractIdentifierFromData(string $className, array $data) : array
    {
        return $this->objectRepositoryFactory
            ->getRepository($className)
            ->getObjectIdentifierFromData($data);
    }
323086
public function createModel($className, $data)
    {
        $model = new $className;

        foreach ($data as $managerName => $value) {
            $is_collection = is_array($value);

            if ($is_collection) {
                $method_name = 'get' . ucfirst($managerName);
            } else {
                $method_name = 'set' . ucfirst($managerName);
            }

            if (!method_exists($model, $method_name)) {
                throw new \RuntimeException(sprintf('Method "%s" does not exist in "%s" class.', $method_name, $className));
            }

            if ($is_collection) {
                foreach ($value as $element) {
                    $model->$method_name()->add($element);
                }
            } else {
                $model->$method_name($value);
            }
        }

        return $model;
    }
1094535
public function create($data)
    {
        $descriptor = new ThrowsDescriptor($data->getName());
        $descriptor->setDescription($data->getDescription());
        $descriptor->setTypes(
            $this->builder->buildDescriptor(new Collection($data->getTypes()))
        );

        return $descriptor;
    }
694575
public function buildDescriptor($data)
    {
        $assembler = $this->getAssembler($data);
        if (!$assembler) {
            throw new \InvalidArgumentException(
                'Unable to build a Descriptor; the provided data did not match any Assembler ' .
                get_class($data)
            );
        }

        if ($assembler instanceof Builder\AssemblerAbstract) {
            $assembler->setBuilder($this);
        }

        // create Descriptor and populate with the provided data
        $descriptor = $assembler->create($data);
        if (!$descriptor) {
            return null;
        }

        return (!is_array($descriptor) && (!$descriptor instanceof Collection))
            ? $this->filterDescriptor($descriptor)
            : $this->filterEachDescriptor($descriptor);
    }
1104237
public function create($data)
    {
        $descriptor = new AuthorDescriptor($data->getName());
        $descriptor->setDescription((string) $data);

        return $descriptor;
    }
1100550
public function deserializeEntity(array $data, $entityOrClass)
    {
        $context = null;
        if (is_object($entityOrClass)) {
            $context = DeserializationContext::create();
            $context->attributes->set('target', $entityOrClass);
            $context->enableMaxDepthChecks(true);
            $entityOrClass = get_class($entityOrClass);
        }

        return $this->getSerializer()->deserialize(json_encode($data), $entityOrClass, 'json',  $context);
    }