@param $class

@return \GraphAware\Neo4j\OGM\Metadata\NodeEntityMetadata
485016
public function getClassMetadataFor($class)
    {
        if (!array_key_exists($class, $this->loadedMetadata)) {
            $this->loadedMetadata[$class] = $this->metadataFactory->create($class);
        }

        return $this->loadedMetadata[$class];
    }
1244260
public static function getClassAnnotations($class)
    {
        $annotationBag = Bridge\Loader::getInstance()->getClassAnnotations($class);
        $annotationBag = self::explodeNamespaces($annotationBag);

        return new ConfigObject($annotationBag);
    }
680017
public static function parsePrimaryData(\stdClass $class)
    {
        $members = get_object_vars($class);
        foreach ($members as $varName => $member) {
            if ($varName == AbstractOperation::GRAPHQL_DATA_KEY) {
                return $member;
            }
            if ($member instanceof \stdClass) {
                return self::parsePrimaryData($member);
            }
        }

        throw new NostoException(
            sprintf(
                'Could not find primary data field (%s) from response',
                AbstractOperation::GRAPHQL_DATA_KEY
            )
        );
    }
1153892
public function createInstance(string $class)
    {
        $refClass = new \ReflectionClass($class);
        $args = [];
        if ($refClass->getConstructor()) {
            foreach ($refClass->getConstructor()->getParameters() as $parameter) {
                $name = Inflector::tableize(str_replace('_', '.', $parameter->getName()));
                $dependency = null;
                if ($parameter->getClass()) {
                    if ($this->container->has($parameter->getClass()->getName())) {
                        $dependency = $this->container->get($parameter->getClass()->getName());
                    } elseif ($this->container->has($name)) {
                        $dependency = $this->container->get($name);
                    }
                } elseif ($this->container->hasParameter($name)) {
                    $dependency = $this->container->getParameter($name);
                }
                $args[] = $dependency;
            }
        }

        return $refClass->newInstanceArgs($args);
    }
879994
public function getParent(ClassMetadata $class)
    {
        $className = $class->getName();
        if (!class_exists($className) || (!$parent = get_parent_class($className))) {
            return null;
        }

        return $this->getClassByName($parent);
    }
1341510
protected function transformMetadata($class)
    {
        $class = clone $class;

        $className = $class->getName();

        $ghostClassName =$class->name;
//        $class->namespace = 'Opifer\\Revisions\\Entity';
//         = $ghostClassName;
//        $class->rootEntityName = $class->name;
        $class->inheritanceType = ClassMetadataInfo::INHERITANCE_TYPE_NONE;

        $class->parentClasses = null;
        $class->discriminatorMap = null;
        $class->discriminatorColumn = null;

        $class->setPrimaryTable(['name' => $class->getTableName() . '_revisions']);
//        $this->name = $entityName;
//        $this->rootEntityName = $entityName;

        foreach ($class->fieldMappings as $key => $fieldMapping) {
            $class->fieldMappings[$fieldMapping['fieldName']]['inherited'] = $ghostClassName;
            $class->fieldMappings[$fieldMapping['fieldName']]['declared'] = $ghostClassName;

            if (! $this->annotationReader->isPropertyRevised($className, $fieldMapping['fieldName']) &&
                ! $class->isIdentifier($fieldMapping['fieldName'])) {
                unset($class->fieldMappings[$fieldMapping['fieldName']]);
                unset($class->fieldNames[$fieldMapping['columnName']]);
                unset($class->columnNames[$fieldMapping['fieldName']]);
                unset($class->reflFields[$fieldMapping['fieldName']]);
            }
        }

        foreach ($class->associationMappings as $key => $associationMapping) {
            $class->associationMappings[$associationMapping['fieldName']]['inherited'] = $ghostClassName;
            $class->associationMappings[$associationMapping['fieldName']]['declared'] = $ghostClassName;

            if (! $this->annotationReader->isPropertyRevised($className, $associationMapping['fieldName']) &&
                ! $class->isIdentifier($associationMapping['fieldName'])) {
                unset($class->associationMappings[$associationMapping['fieldName']]);
                unset($class->reflFields[$associationMapping['fieldName']]);
            }
        }

//        if (! isset($class->fieldMappings['revisionId'])) {
//            $revisionMapping = [
//                'fieldName' => 'revisionId',
//                'columnName' => 'revision_id',
//                'type' => 'integer',
//            ];
//
//            $class->mapField($revisionMapping);
//            $this->addReflectionField($class, $revisionMapping['fieldName']);
//
//            $revisionMapping = [
//                'fieldName' => 'revisionType',
//                'columnName' => 'rev_type',
//                'type' => 'string',
//            ];
//
//            $class->mapField($revisionMapping);
//            $this->addReflectionField($class, $revisionMapping['fieldName']);
//
//            $revisionMapping = [
//                'fieldName' => 'draft',
//                'columnName' => 'draft',
//                'type' => 'boolean',
//            ];
//
//            $class->mapField($revisionMapping);
//            $this->addReflectionField($class, $revisionMapping['fieldName']);
//        }

//        $mock = new $ghostClassName;
//        foreach ($class->reflFields as $key => $reflectionProperty) {
//            $mock->$key = null;
//            $class->reflFields[$key] = new \ReflectionProperty($mock, $key);
//        }

        return $class;
    }
1117085
private function getEntityName($entityClass)
    {
        if ($this->metadataManager->hasMetadata($entityClass)) {
            return $this->metadataManager->getMetadata($entityClass)->getEntityName();
        }
        if ($this->translatableManager->isTranslation($entityClass)) {
            /** @var \Knp\DoctrineBehaviors\Model\Translatable\Translation $entityClass */
            $translatableClass = $entityClass::getTranslatableEntityClass();

            if ($this->metadataManager->hasMetadata($translatableClass)) {
                return $this->metadataManager->getMetadata($translatableClass)->getEntityName().'_translation';
            }
        }

        return $this->objectNamer->name($entityClass);
    }
1341459
public function getObjectMapping(string $class): DenormalizationObjectMappingInterface
    {
        $reflectionClass = new \ReflectionClass($class);

        if (in_array('Doctrine\Common\Persistence\Proxy', $reflectionClass->getInterfaceNames(), true)) {
            $reflectionParentClass = (new \ReflectionClass($class))->getParentClass();
            if ($reflectionParentClass instanceof \ReflectionClass) {
                $class = $reflectionParentClass->getName();
            }
        }

        if (isset($this->objectMappings[$class])) {
            return $this->objectMappings[$class];
        }

        throw DeserializerLogicException::createMissingMapping($class);
    }
164343
public function create($nodeEntityClass)
    {
        $reflectionClass = new \ReflectionClass($nodeEntityClass);
        /** @var Node $annotation */
        $annotation = $this->reader->getClassAnnotation($reflectionClass, Node::class);

        if (null !== $annotation) {
            return new NodeAnnotationMetadata($annotation->label, $annotation->repository);
        }

        throw new MappingException(sprintf('The class "%s" is missing the "%s" annotation', $nodeEntityClass, Node::class));
    }
1239643
public function forClass(string $class): MetaClass
    {
        $cacheName = 'MetaForClass:' . $class;
        $meta = $this->cache->get($cacheName);

        if (!$meta instanceof MetaClass) {
            $data = $this->source->forClass($class);
            $meta = $this->asMeta($data);

            $this->cache->set($cacheName, $meta);
        }

        return $meta;
    }
400776
public function getManagerForClass($class)
    {
        // Check for namespace alias
        if (strpos($class, ':') !== false) {
            list($namespaceAlias, $simpleClassName) = explode(':', $class, 2);
            $class                                  = $this->getAliasNamespace($namespaceAlias) . '\\' . $simpleClassName;
        }

        $proxyClass = new ReflectionClass($class);
        if ($proxyClass->implementsInterface(Proxy::class)) {
            $class = $proxyClass->getParentClass()->getName();
        }

        $managerNames = $this->getManagerNames();

        if (count($managerNames) === 1) {
            return $this->getManager(reset($managerNames));
        }

        foreach ($managerNames as $name) {
            $manager = $this->getManager($name);

            if (!$manager->getMetadataFactory()->isTransient($class)) {
                foreach ($manager->getMetadataFactory()->getAllMetadata() as $metadata) {
                    if ($metadata->getName() === $class) {
                        return $manager;
                    }
                }
            }
        }
    }
1177561
public static function getInstance($class)
    {
        $reflection = new ReflectionClass($class);
        $constructor = $reflection->getConstructor();

        if (empty($constructor)) {
            return new $class;
        }

        $parameters = $constructor->getParameters();

        if (empty($parameters)) {
            return new $class;
        }

        $dependencies = array();
        foreach ($parameters as $parameter) {
            $parameter_class = $parameter->getClass();
            $dependencies[] = static::get($parameter_class->getName());
        }

        return $reflection->newInstanceArgs($dependencies);
    }
898902
public function getRoot(string $class)
    {
        if (!is_a($class, Hierarchy::class, true))
            throw new TypeError("Not a subclass of Hierarchy: $class");

        $root = $class::getRootName();
        return $this->getInstance($class, $root);
    }
436270
public function buildNodeEntityMetadata(\SimpleXMLElement $node, $className)
    {
        $reflection = new \ReflectionClass($className);

        return new NodeEntityMetadata(
            $className,
            $reflection,
            $this->buildNodeMetadata($node, $className),
            $this->idXmlMetadataFactory->buildEntityIdMetadata($node, $className, $reflection),
            $this->propertyXmlMetadataFactory->buildPropertiesMetadata($node, $className, $reflection),
            $this->relationshipXmlMetadataFactory->buildRelationshipsMetadata($node, $className, $reflection)
        );
    }
1194778
public function resolveClassNameToType($class): Type
    {
        if ($class instanceof Node\Expression) {
            return new Types\Mixed_;
        }
        if ($class instanceof PhpParser\Token && $class->kind === PhpParser\TokenKind::ClassKeyword) {
            // Anonymous class
            return new Types\Object_;
        }
        if ($class instanceof PhpParser\Token && $class->kind === PhpParser\TokenKind::StaticKeyword) {
            // `new static`
            return new Types\Static_;
        }
        $className = (string)$class->getResolvedName();

        if ($className === 'self' || $className === 'parent') {
            $classNode = $class->getFirstAncestor(Node\Statement\ClassDeclaration::class);
            if ($className === 'parent') {
                if ($classNode === null || $classNode->classBaseClause === null) {
                    return new Types\Object_;
                }
                // parent is resolved to the parent class
                $classFqn = (string)$classNode->classBaseClause->baseClass->getResolvedName();
            } else {
                if ($classNode === null) {
                    return new Types\Self_;
                }
                // self is resolved to the containing class
                $classFqn = (string)$classNode->getNamespacedName();
            }
            return new Types\Object_(new Fqsen('\\' . $classFqn));
        }
        return new Types\Object_(new Fqsen('\\' . $className));
    }
820883
public function getEntityRepositories($class)
    {
        $identifiers = $this->getEntityIdentifiers($class);

        foreach ($identifiers as $i => $identifier) {
            $identifiers[$i] = AnDomain::getRepository($identifier);
        }

        return $identifiers;
    }
806790
public function loadMetadataForClass(\ReflectionClass $class)
    {
        $classMetadata = new ClassMetadata($class->getName());

        foreach ($class->getMethods(\ReflectionMethod::IS_PUBLIC) as $reflectionMethod) {
            if (false === strpos($reflectionMethod->getName(), 'Action')) {
                continue;
            }

            if ($reflectionMethod->isAbstract()) {
                continue;
            }

            $methodMetadata = new ActionMetadata($class->getName(), $reflectionMethod->getName());

            $annotations = $this->reader->getMethodAnnotations($reflectionMethod);

            foreach ($annotations as $annotation) {
                if ($annotation instanceof \BackBee\Rest\Controller\Annotations\QueryParam) {
                    $data = array(
                        'name' => $annotation->name,
                        'key' => $annotation->key ? $annotation->key : $annotation->name,
                        'default' => $annotation->default,
                        'description' => $annotation->description,
                        'requirements' => $annotation->requirements,
                    );

                    $methodMetadata->queryParams[] = $data;
                } elseif ($annotation instanceof \BackBee\Rest\Controller\Annotations\RequestParam) {
                    $data = array(
                        'name' => $annotation->name,
                        'key' => $annotation->key ? $annotation->key : $annotation->name,
                        'default' => $annotation->default,
                        'description' => $annotation->description,
                        'requirements' => $annotation->requirements,
                    );

                    $methodMetadata->requestParams[] = $data;
                } elseif ($annotation instanceof \BackBee\Rest\Controller\Annotations\Pagination) {
                    $methodMetadata->default_start = $annotation->default_start;
                    $methodMetadata->default_count = $annotation->default_count;
                    $methodMetadata->max_count = $annotation->max_count;
                    $methodMetadata->min_count = $annotation->min_count;
                } elseif ($annotation instanceof \BackBee\Rest\Controller\Annotations\ParamConverter) {
                    $methodMetadata->param_converter_bag[] = $annotation;
                } elseif ($annotation instanceof \BackBee\Rest\Controller\Annotations\Security) {
                    $methodMetadata->security[] = $annotation;
                }
            }

            $classMetadata->addMethodMetadata($methodMetadata);
        }

        return $classMetadata;
    }