@param ReflectionClass $reflectionClass

@return ReflectionProperty[]
504965
private function getClassProperties(ReflectionClass $reflectionClass)
    {
        $properties = $reflectionClass->getProperties();

        return array_filter(
            array_filter(array_map(
                [$this, 'getAccessibleProperty'],
                array_combine(
                    array_map([$this, 'getLogicalName'], $properties),
                    $properties
                )
            )),
            [$this, 'isInstanceProperty']
        );
    }
185569
private function extractMethods(\ReflectionClass $objectClass): array
    {
        return methodsOf($objectClass, \ReflectionMethod::IS_PUBLIC)
                ->filter(function(\ReflectionMethod $method)
                        {
                            if ($method->getNumberOfParameters() != 0
                                    || $method->isStatic()
                                    || $method->isConstructor()
                                    || $method->isDestructor()
                                    || 0 == strncmp($method->getName(), '__', 2)) {
                                return false;
                            }

                            return !annotationsOf($method)->contain('XmlIgnore');
                        }
                )->map(function(\ReflectionMethod $method)
                        {
                            return $this->createSerializerDelegate(
                                    annotationsOf($method),
                                    $method->getName()
                            );
                        }

                )->data();
    }
744079
private static function getProperties($class): array
    {
        $reflect = new \ReflectionClass($class);
        $prop = $reflect->getProperties(
            \ReflectionProperty::IS_PUBLIC | \ReflectionProperty::IS_PROTECTED | \ReflectionProperty::IS_PRIVATE
        );
        $properties = [];
        foreach ($prop as $property) {
            $properties[] = $property->name;
        }
        $parent = \get_parent_class($class);
        if ($parent) {
            $properties = \array_merge(self::getProperties($parent), $properties);
        }
        return $properties;
    }
841691
protected function createInstance(\ReflectionClass $reflectedClass)
    {
        $constructor = $reflectedClass->getConstructor();

        if ($constructor && $constructor->getNumberOfRequiredParameters() > 0) {
            throw new \RuntimeException('Unable to hydrate an object requiring constructor param');
        }

        return $reflectedClass->newInstance();
    }
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;
	}
1090301
public function loadMetadataForClass(\ReflectionClass $class)
    {
        $classMetadata                  = new MergeableClassMetadata($name = $class->name);
        $classMetadata->fileResources[] = $class->getFileName();

        foreach ($class->getProperties() as $property) {
            $propertyMetadata = new PropertyMetadata($name, $property->getName());
            $propertyAnnotations = $this->reader->getPropertyAnnotations($property);

            foreach ($propertyAnnotations as $annotation) {
                if ($annotation instanceof Fixture\Data) {
                    $propertyMetadata->staticData = $annotation->value;
                } elseif ($annotation instanceof Fixture\Faker) {
                    $propertyMetadata->fakerName = $annotation->name;
                    $propertyMetadata->fakerResolverType = $annotation->type;
                    $propertyMetadata->fakerResolverArgs = $annotation->arguments;
                } elseif ($annotation instanceof Fixture\Ignore) {
                    $propertyMetadata->ignore = true;
                }
            }

            $classMetadata->addPropertyMetadata($propertyMetadata);
        }

        return $classMetadata;
    }
412862
protected function getClassProperties(\ReflectionClass $refClass)
    {
        $props = [];

        //fields from parents, including private fields
        $currentClass = $refClass;
        while ($parent = $currentClass->getParentClass()) {
            foreach ($parent->getProperties() as $prop) {
                $props[$prop->name] = $prop;
            }
            $currentClass = $parent;
        }

        foreach ($refClass->getProperties() as $prop) {
            $props[$prop->name] = $prop;
        }

        return $props;
    }
594089
private function loadTranslationMetadata(\ReflectionClass $class)
    {
        $classMetadata = new TranslationMetadata($class->name);

        foreach ($class->getProperties() as $property) {
            if ($property->class !== $class->name) {
                continue;
            }

            $propertyMetadata = new PropertyMetadata($class->name, $property->getName());

            if ($annot = $this->reader->getPropertyAnnotation($property, 'Prezent\\Doctrine\\Translatable\\Annotation\\Translatable')) {
                $classMetadata->targetEntity = $annot->targetEntity;
                $classMetadata->translatable = $propertyMetadata;
                $classMetadata->addPropertyMetadata($propertyMetadata);
            }

            if ($this->reader->getPropertyAnnotation($property, 'Prezent\\Doctrine\\Translatable\\Annotation\\Locale')) {
                $classMetadata->locale = $propertyMetadata;
                $classMetadata->addPropertyMetadata($propertyMetadata);
            }
        }

        return $classMetadata;
    }
349468
public function getConditions(ReflectionClass $class, string $methodName): array
    {
        $annotations   = [];
        $parentMethods = [];
        $docComment    = $class->getMethod($methodName)->getDocComment();

        if ($docComment === false) {
            return $annotations;
        }

        if (\preg_match('/\@inheritdoc/i', $docComment)) {
            $this->getParentClassesMethods($class, $methodName, $parentMethods);
            $this->getInterfacesMethods($class, $methodName, $parentMethods);
        }

        foreach ($parentMethods as $parentMethod) {
            $annotations[] = $this->annotationReader->getMethodAnnotations($parentMethod);
        }

        if (\count($annotations)) {
            $annotations = \array_merge(...$annotations);
        }

        return $this->filterContractAnnotation($annotations);
    }
13747
public function findProperties(ReflectionClass $reflectionClass)
	{
		$allProperties = [];

		/** @var ReflectionClass $currentReflectionClass */
		$currentReflectionClass = $reflectionClass;

		while ($currentReflectionClass) {// class without parent has null in getParentClass()

			$properties = $currentReflectionClass->getProperties();

			foreach ($properties as $property) {
				if (isset($allProperties[$property->getName()])) {
					// Do not add the same property few times
					// If parent class has public or protected property - the same property will be returned for the Child class
					// As child class is processed first - its property will be taken
					continue;
				}

				$allProperties[$property->getName()] = $property;
			}

			$currentReflectionClass = $currentReflectionClass->getParentClass();
		}

		return $allProperties;
	}
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;
    }
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;
    }
377842
protected function loadBusinessProperties(\ReflectionClass $class)
    {
        $businessProperties = [];
        $properties = $class->getProperties();
        $traits = $class->getTraits();
        $className = $class->getName();
        // if the class is translatable, then parse annotations on it's translation class
        if (array_key_exists(Translatable::class, $traits)) {
            $translation = new \ReflectionClass($className::getTranslationEntityClass());
            $translationProperties = $translation->getProperties();
            $properties = array_merge($properties, $translationProperties);
        }

        foreach ($properties as $property) {
            $annotations = $this->reader->getPropertyAnnotations($property);
            foreach ($annotations as $key => $annotationObj) {
                if ($annotationObj instanceof BusinessProperty && !in_array($class, $businessProperties)) {
                    if (!$annotations[$key]->getTypes()) {
                        $message = $class->name.':$'.$property->name.'" field';

                        throw AnnotationException::requiredError('type', 'BusinessProperty annotation', $message, 'array or string');
                    }
                    foreach ($annotations[$key]->getTypes() as $type) {
                        $businessProperties[$type][] = $property->name;
                    }
                }
            }
        }
        // we load business properties of parents recursively
        // because they are defined by an annotation not by the property type(private, protected, public)
        $parentClass = $class->getParentClass();
        if ($parentClass) {
            //load parent properties recursively
            $parentProperties = $this->loadBusinessProperties(new \ReflectionClass($parentClass->getName()));
            foreach ($parentProperties as $key => $parentProperty) {
                if (array_key_exists($key, $businessProperties)) {
                    //if parent and current have a same business property type we merge the properties and remove
                    //duplicates if properties are the same;
                    $businessProperties[$key] = array_unique(array_merge($parentProperty, $businessProperties[$key]));
                } else {
                    //else we had a business property type for the parent properties
                    $businessProperties[$key] = $parentProperty;
                }
            }
        }

        return $businessProperties;
    }
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();
    }
550766
protected function getConstructParameters(ReflectionClass $reflectionClass, array $data): array
    {
        $constructor = $reflectionClass->getConstructor();
        if ($constructor instanceof ReflectionMethod) {
            foreach ($constructor->getParameters() as $parameter) {
                $name = $parameter->getName();

                $class = $parameter->getClass();
                if ($class instanceof ReflectionClass) {
                    $value = $class->newInstanceArgs(
                        $this->getConstructParameters($class, $data[$name] ?? [])
                    );
                } elseif (array_key_exists($name, $data) === true) {
                    $value = $data[$name];
                } elseif ($parameter->isDefaultValueAvailable() === true) {
                    $value = $parameter->getDefaultValue();
                } elseif ($parameter->allowsNull() === true) {
                    $value = null;
                } else {
                    throw new MissingConstructParameter($parameter);
                }

                $parameters[$name] = $value;
            }
        }

        return $parameters ?? [];
    }
199331
public function getNewInstance(\ReflectionClass $class) : NewInstance
    {
        $setterMethods = new SetterMethods([]);
        $methods = $class->getMethods();
        foreach ($methods as $method) {
            if ($method->name === '__construct') {
                continue;
            }
            $setterMethods->add($this->injectionMethod->getSetterMethod($method));
        }
        $name = $this->injectionMethod->getConstructorName($class);

        return new NewInstance($class, $setterMethods, $name);
    }
745904
private function accessProperty(ReflectionClass $reflection, $property)
    {
        $propertyReflection = $reflection->getProperty($property);
        $propertyReflection->setAccessible(true);

        return $propertyReflection;
    }