@param ReflectionClass $reflectionClass

@return ReflectionProperty[]
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;
	}
859691
protected function getClassTraits(\ReflectionClass $reflector): array
    {
        $class = $reflector->getName();

        $traits = array();

        do
        {
            $traits = array_merge(class_uses($class), $traits);
        }
        while ($class = get_parent_class($class));

        foreach ($traits as $trait)
            $traits = array_merge(class_uses($trait), $traits);

        return array_keys(array_unique($traits));
    }
910621
private static function getMethodRequiredClassesByClass(\ReflectionClass $rc) : array
    {
        $classes = [];
        
        foreach($rc->getMethods() as $rm){
            $classes = array_merge($classes, self::getMethodRequiredClassesByMethod($rm));
        }
        
        return array_unique($classes);
    }
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();
    }
1127683
private function getPropertyMapping(ReflectionProperty $property)
    {
        $metadata = [];

        foreach ($this->reader->getPropertyAnnotations($property) as $value) {
            if ( ! $value instanceof RiakAnnotation) {
                continue;
            }

            $class = get_class($value);
            $name  = $property->getName();
            $key   = lcfirst(substr($class, strrpos($class, '\\') + 1));

            $metadata[$key] = $name;
        }

        return $metadata;
    }
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;
    }
107603
protected function getPropertiesMeta(ReflectionClass $reflection): array
    {
        $meta = [];
        $properties = $reflection->getProperties(ReflectionProperty::IS_PUBLIC);

        foreach ($properties as $item) {
            $doc = $item->getDocComment();
            $notations = $this->parser->parse($doc);

            if (count($notations) > 0) {
                $meta[$item->getName()] = $notations;
            }
        }

        return $meta;
    }
681988
public function extractRelations(\ReflectionClass $reflection)
    {
        $propertyList = $reflection->getDefaultProperties();

        if ($this->cache && $res = $this->cache->get(md5(json_encode($propertyList)))) {
            return $res;
        }

        $relation = [];

        foreach ($propertyList as $name => $value) {
            $comment = $reflection->getProperty($name)->getDocComment();
            $d = $this->parser->parse($comment);
            if (!$d) {
                continue;
            }
            $relation[] = [
                'mapping_id' => $d[0],
                'model'      => $d[1],
                'target'     => $name
            ];
        }

        if ($this->cache) {
            $this->cache->set(md5(json_encode($propertyList)), $relation, 300);
        }

        return $relation;
    }
495264
public function forClass(string $class): array
    {
        if (!class_exists($class)) {
            throw new InvalidArgumentException("Cannot get meta for non-exist class '$class'");
        }

        $reflection = $this->factory->reflectClass($class);

        $meta = $this->getClassMeta($reflection);
        $meta['@properties'] = $this->getPropertiesMeta($reflection);

        return $meta;
    }
824993
private static function getSetters(\ReflectionClass $reflectionClass)
    {
        foreach ($reflectionClass->getMethods(\ReflectionMethod::IS_PUBLIC) as $reflectionMethod) {
            if (!$reflectionMethod->isStatic() && 1 === $reflectionMethod->getNumberOfParameters() && 0 === strpos($reflectionMethod->name, 'set')) {
                yield $reflectionMethod;
            }
        }
    }
856562
public static function getClassProperties($class)
    {
        $properties = [];
        Logger::log('Extracting annotations properties from class ' . $class);
        $selfReflector = new \ReflectionClass($class);
        if (false !== $selfReflector->getParentClass()) {
            $properties = self::getClassProperties($selfReflector->getParentClass()->getName());
        }
        $properties = array_merge($properties, self::extractProperties($selfReflector));
        return $properties;
    }
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())));
    }
1229921
public function parse(\ReflectionClass $class)
    {
        $classPath = dirname($class->getFileName());
        $inPaths = false;

        foreach ($this->paths as $key => $_path) {
            //Check the entity path is in watching paths
            if (strpos($classPath, realpath($_path)) === 0) {
                $inPaths = true;
            }
        }

        if ($inPaths) {
            $classAnnotations = $this->reader->getClassAnnotations($class);

            if (!empty($classAnnotations)) {
                foreach ($classAnnotations as $key => $annot) {
                    if (!is_numeric($key)) {
                        continue;
                    }

                    $classAnnotations[get_class($annot)] = $annot;
                }
            }

            // Evaluate Entity annotation
            if (isset($classAnnotations['Victoire\Bundle\CoreBundle\Annotations\BusinessEntity'])) {
                /** @var BusinessEntity $annotationObj */
                $annotationObj = $classAnnotations['Victoire\Bundle\CoreBundle\Annotations\BusinessEntity'];
                $businessEntity = BusinessEntityHelper::createBusinessEntity(
                    $class->getName(),
                    $this->loadBusinessProperties($class)
                );

                $event = new BusinessEntityAnnotationEvent(
                    $businessEntity,
                    $annotationObj->getWidgets()
                );

                //do what you want (caching BusinessEntity...)
                $this->eventDispatcher->dispatch('victoire.business_entity_annotation_load', $event);
            }

            //check if the entity is a widget (extends (in depth) widget class)
            $parentClass = $class->getParentClass();
            $isWidget = false;
            while ($parentClass && ($parentClass = $parentClass->getParentClass()) && !$isWidget && $parentClass->name != null) {
                $isWidget = $parentClass->name === 'Victoire\\Bundle\\WidgetBundle\\Model\\Widget';
            }

            if ($isWidget) {
                if ($this->widgetHelper->isEnabled(new $class->name())) {
                    $event = new WidgetAnnotationEvent(
                        $this->widgetHelper->getWidgetName(new $class->name()),
                        $this->loadReceiverProperties($class)
                    );

                    //dispatch victoire.widget_annotation_load to save receiverProperties in cache
                    $this->eventDispatcher->dispatch('victoire.widget_annotation_load', $event);
                } else {
                    error_log(sprintf('Widget name not found for widget %s. Is this widget declared in AppKernel ?', $class->name));
                }
            }
        }
    }
434234
protected function getProperty(\ReflectionClass $reflection, $propertyName): ReflectionProperty
    {
        $property = $reflection->getProperty($propertyName);
        $property->setAccessible(true);
        return $property;
    }
1237870
private function getRiakPropertiesMapping(ReflectionClass $reflection)
    {
        $properties = $reflection->getProperties();
        $metadata   = [];

        foreach ($properties as $property) {
            $metadata = array_merge($this->getPropertyMapping($property), $metadata);
        }

        return $metadata;
    }
1151508
protected function getPropertyWriters(\ReflectionClass $originalClass)
    {
        $propertyWriters = $this->getProperties($originalClass, \ReflectionProperty::IS_PRIVATE);

        foreach ($propertyWriters as &$property) {
            $property = new PropertyAccessor($property, 'Writer');
        }

        return $propertyWriters;
    }