Get meta data for class properties

@param ReflectionClass $reflection
@return array
547241
protected function getPropertiesMeta(ReflectionClass $reflection): array
    {
        $meta = [];
        $defaults = $reflection->getDefaultProperties();
        $properties = $reflection->getProperties(ReflectionProperty::IS_PUBLIC);

        foreach ($properties as $item) {
            $name = $item->getName();
            $meta[$name] = [
                'name' => $name,
                'title' => uncase($name)
            ];

            if (array_key_exists($name, $defaults)) {
                $meta[$name]['default'] = $defaults[$name];
            }
        }

        return $meta;
    }
343399
protected function findProperties(\ReflectionClass $reflection): void
    {
        if (false !== $reflection->getParentClass()) {
            $this->findProperties($reflection->getParentClass());
        }

        $this->properties = array_unique(array_merge($this->properties, array_keys($reflection->getDefaultProperties())));
    }
294522
public function getMetadata($objectClass)
    {
        if (! $objectClass instanceof ObjectKey) {
            $objectClass = new ObjectKey($objectClass);
        }

        $key = $objectClass->getKey();

        return $this->classMetadataFactory->loadMetadata(
            $objectClass,
            LoadingCriteria::createFromConfiguration($this->configuration, $objectClass),
            $this->configuration
        );
    }
242504
public function loadMetadataForClass(\ReflectionClass $reflectionClass)
    {
        $className = $reflectionClass->getName();
        $classMetadata = new ClassMetadata($className);
        $classMetadata->fileResources[] = $reflectionClass->getFileName();

        $encryptionAnnotation = $this->reader->getClassAnnotation(
            $reflectionClass,
            'Jagilpe\\EncryptionBundle\\Annotation\\EncryptedEntity'
        );
        /** @var EncryptedEntity $encryptionAnnotation */
        if ($encryptionAnnotation) {
            $classMetadata->encryptionEnabled = $encryptionAnnotation->enabled;
            $classMetadata->encryptionMode = $encryptionAnnotation->mode;

            $encryptedFileAnnotation = $this->reader->getClassAnnotation(
                $reflectionClass,
                'Jagilpe\\EncryptionBundle\\Annotation\\EncryptedFile'
            );

            /** @var EncryptedFile $encryptedFileAnnotation */
            if ($encryptedFileAnnotation) {
                $classMetadata->encryptedFile = $encryptedFileAnnotation->enabled;
                $classMetadata->encryptedFileMode = $encryptedFileAnnotation->mode;
            }

            foreach ($reflectionClass->getProperties() as $reflectionProperty) {
                $propertyAnnotation = $this->reader->getPropertyAnnotation(
                    $reflectionProperty,
                    'Jagilpe\\EncryptionBundle\\Annotation\\EncryptedField'
                );

                /** @var EncryptedField $propertyAnnotation */
                if ($propertyAnnotation) {
                    $propertyMetadata = new PropertyMetadata($reflectionClass->getName(), $reflectionProperty->getName());
                    $propertyMetadata->encrypted = $propertyAnnotation->enabled;

                    $classMetadata->addPropertyMetadata($propertyMetadata);
                }
            }
        }
        else {
            $classMetadata->encryptionEnabled = false;
        }

        return $classMetadata;
    }
169618
private function getAnalyzers(\ReflectionClass $reflectionClass)
    {
        $analyzers = [];

        foreach ($this->getDocumentPropertiesReflection($reflectionClass) as $name => $property) {
            $directory = $this->guessDirName($property->getDeclaringClass());

            $type = $this->getPropertyAnnotationData($property);
            $type = $type !== null ? $type : $this->getEmbeddedAnnotationData($property);

            if ($type instanceof Embedded) {
                $analyzers = array_merge(
                    $analyzers,
                    $this->getAnalyzers(new \ReflectionClass($this->finder->getNamespace($type->class, $directory)))
                );
            }

            if ($type instanceof Property) {
                if (isset($type->options['analyzer'])) {
                    $analyzers[] = $type->options['analyzer'];
                }
                if (isset($type->options['search_analyzer'])) {
                    $analyzers[] = $type->options['search_analyzer'];
                }

                if (isset($type->options['fields'])) {
                    foreach ($type->options['fields'] as $field) {
                        if (isset($field['analyzer'])) {
                            $analyzers[] = $field['analyzer'];
                        }
                        if (isset($field['search_analyzer'])) {
                            $analyzers[] = $field['search_analyzer'];
                        }
                    }
                }
            }
        }
        return array_unique($analyzers);
    }
64763
private function getProperties(ClassMetadata $metadata)
    {
        return array_merge(
            $metadata->getFieldNames(),
            array_map(function (array $mapping) {
                return $mapping['fieldName'];
            }, $metadata->getEmbeddedFieldsMappings())
        );
    }
23421
public function getProperties($value, ReflectionClass $class, $propertyFilter)
	{
		$properties = [];

		foreach (self::$appProperties as $property)
		{
			try
			{
				$val = $value->$property();

				if ( ! is_null($val)) $properties[$property] = $val;
			}
			catch (Exception $e)
			{
				//
			}
		}

		return $properties;
	}
1156868
private function getLazyLoadedPublicProperties(ClassMetadata $class)
    {
        $defaultProperties = $class->getReflectionClass()->getDefaultProperties();
        $properties        = [];

        foreach ($class->getReflectionClass()->getProperties(\ReflectionProperty::IS_PUBLIC) as $property) {
            $name = $property->getName();

            if (($class->hasField($name) || $class->hasAssociation($name)) && ! $class->isIdentifier($name)) {
                $properties[$name] = $defaultProperties[$name];
            }
        }

        return $properties;
    }
454681
private function convertClassAnnotationsToClassMetadata(
        ReflectionClass $reflectionClass,
        array $classAnnotations,
        Mapping\ClassMetadata $metadata,
        Mapping\ClassMetadataBuildingContext $metadataBuildingContext
    ) : Mapping\ClassMetadata {
        switch (true) {
            case isset($classAnnotations[Annotation\Entity::class]):
                $binder = new Binder\EntityClassMetadataBinder(
                    $reflectionClass,
                    $classAnnotations,
                    $metadata,
                    $metadataBuildingContext
                );

                break;

            case isset($classAnnotations[Annotation\MappedSuperclass::class]):
                $binder = new Binder\MappedSuperClassMetadataBinder(
                    $reflectionClass,
                    $classAnnotations,
                    $metadata,
                    $metadataBuildingContext
                );
                break;

            case isset($classAnnotations[Annotation\Embeddable::class]):
                $binder = new Binder\EmbeddableClassMetadataBinder(
                    $reflectionClass,
                    $classAnnotations,
                    $metadata,
                    $metadataBuildingContext
                );
                break;

            default:
                throw Mapping\MappingException::classIsNotAValidEntityOrMappedSuperClass($reflectionClass->getName());
        }

        return $binder->bind();
    }
1096028
public static function getPrivateProperty(\ReflectionClass $reflectionClass, $property)
    {
        if (!$reflectionClass->hasProperty($property) && $reflectionClass->getParentClass()) {
            return static::getPrivateProperty($reflectionClass->getParentClass(), $property);
        }

        return $reflectionClass->getProperty($property);
    }
287750
public function parseClass(\ReflectionClass $class)
    {
        if (false === $filename = $class->getFilename()) {
            return array();
        }

        $content = $this->getFileContent($filename, $class->getStartLine());
        $namespace = str_replace('\\', '\\\\', $class->getNamespaceName());
        $content = preg_replace('/^.*?(\bnamespace\s+' . $namespace . '\s*[;{].*)$/s', '\\1', $content);
        $this->tokens = token_get_all('<?php ' . $content);
        $this->numTokens = count($this->tokens);
        $this->pointer = 0;

        $statements = $this->parseUseStatements($class->getNamespaceName());

        return $statements;
    }
700098
protected function getClassMeta(ReflectionClass $reflection): array
    {
        $doc = $reflection->getDocComment();
        $notations = $this->parser->parse($doc);

        return $notations;
    }
300120
protected function propertiesToArray(ReflectionObject $reflection)
    {
        $properties = $reflection->getProperties(ReflectionProperty::IS_PUBLIC);

        $data = [];

        foreach ($properties as $property) {
            if ($property->class !== __CLASS__) {
                $data[$property->name] = $this->{$property->name};
            }
        }

        return $data;
    }
433285
public function parseTableName(\ReflectionClass $reflection)
    {
        $hd = $this->parser->parse($reflection->getDocComment());

        if (!empty($hd[0])) {
            return $hd[1];
        }

        $table = substr($reflection->getName(), strlen($reflection->getNamespaceName()));

        return strtolower(str_replace('\\', '', $table));
    }
1140838
public function getParameters()
    {
        $function = array($this->getDeclaringClass()->getName(), $this->getName());
        $res = parent::getParameters();

        foreach ($res as $key => $val) {
            $res[$key] = new ReflectionParameter($function, $val->getName());
        }

        return $res;
    }
776405
private function getPhpFileStmt(\ReflectionClass $class) : array
    {
        $traverser = new NodeTraverser();
        $visitor = new CodeGenVisitor();
        $traverser->addVisitor($visitor);
        $fileName = $class->getFileName();
        if (is_bool($fileName)) {
            throw new InvalidSourceClassException(get_class($class));
        }
        $file = file_get_contents($fileName);
        if ($file === false) {
            throw new \RuntimeException($fileName); // @codeCoverageIgnore
        }
        $stmts = $this->parser->parse($file);
        if (is_array($stmts)) {
            $traverser->traverse($stmts);
        }

        return $visitor();
    }
263285
private function getHashMapAnnotationData(\ReflectionProperty $property)
    {
        $result = $this->reader->getPropertyAnnotation($property, self::HASH_MAP_ANNOTATION);

        if ($result !== null && $result->name === null) {
            $result->name = Caser::snake($property->getName());
        }

        return $result;
    }