@param \ReflectionClass $reflectionClass

@return bool
348884
public function hasCache(\ReflectionClass $reflectionClass)
    {
        if ('prod' !== strtolower($this->kernel->getEnvironment())) {
            return false;
        }

        if (file_exists($this->loadCache($reflectionClass)) && 'prod' === strtolower($this->kernel->getEnvironment())) {
            return true;
        }

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

        // should class be exposed?
        $annotation = $this->reader->getClassAnnotation(
            $class,
            Entity\Expose::class
        );

        $classMetadata->setExposed($annotation !== null);

        // not exposed so just return here
        if (!$classMetadata->isExposed()) {
            return $classMetadata;
        }

        if ($annotation->name) {
            $classMetadata->setExposedName($annotation->name);
        }

        $this->parseProperties($class, $classMetadata);

        while ($class = $class->getParentClass()) {
            $this->parseProperties($class, $classMetadata);
        }

        return $classMetadata;
    }
637688
private function hasSetMethod($reflectionClass, $propertyName): bool
    {
        $studlyProperty = $this->studly($propertyName);
        $methodName = 'set' . $studlyProperty;
        $exists = $reflectionClass->hasMethod($methodName);

        return $exists;
    }
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));
                }
            }
        }
    }
1004612
public function loadMetadataForClass(\ReflectionClass $class)
    {
        $classMetadata = new ClassMetadata($class->name);
        $classMetadata->fileResources[] = $class->getFilename();

        foreach ($this->reader->getClassAnnotations($class) as $annotation) {
            if ($annotation instanceOf Schema) {
                $classMetadata->schema = $annotation->name;
            }
            if ($annotation instanceOf Inherit) {
                $classMetadata->inherit = $annotation->name;
            }
        }

        if (null !== $classMetadata->schema) {
            return $classMetadata;
        }

        return null;
    }
349543
public static function buildFromReflection(\ReflectionClass $class)
    {
        $classDefinition = new self($class->getNamespaceName(), $class->getName(), $class->getShortName());

        $methods = $class->getMethods();
        if (\count($methods) > 0) {
            foreach ($methods as $method) {
                $parameters = [];

                foreach ($method->getParameters() as $row) {
                    $params = [
                        'type' => 'parameter',
                        'name' => $row->getName(),
                        'const' => 0,
                        'data-type' => 'variable',
                        'mandatory' => !$row->isOptional(),
                    ];
                    if (!$params['mandatory']) {
                        try {
                            $params['default'] = $row->getDefaultValue();
                        } catch (\ReflectionException $e) {
                            // TODO: dummy default value
                            $params['default'] = true;
                        }
                    }
                    $parameters[] = $params;
                }

                $classMethod = new ClassMethod(
                    $classDefinition,
                    [],
                    $method->getName(),
                    new ClassMethodParameters($parameters)
                );
                $classMethod->setIsStatic($method->isStatic());
                $classMethod->setIsBundled(true);
                $classDefinition->addMethod($classMethod);
            }
        }

        $constants = $class->getConstants();
        if (\count($constants) > 0) {
            foreach ($constants as $constantName => $constantValue) {
                $type = self::_convertPhpConstantType(\gettype($constantValue));
                $classConstant = new ClassConstant($constantName, ['value' => $constantValue, 'type' => $type], null);
                $classDefinition->addConstant($classConstant);
            }
        }

        $properties = $class->getProperties();
        if (\count($properties) > 0) {
            foreach ($properties as $property) {
                $visibility = [];

                if ($property->isPublic()) {
                    $visibility[] = 'public';
                }

                if ($property->isPrivate()) {
                    $visibility[] = 'private';
                }

                if ($property->isProtected()) {
                    $visibility[] = 'protected';
                }

                if ($property->isStatic()) {
                    $visibility[] = 'static';
                }

                $classProperty = new ClassProperty(
                    $classDefinition,
                    $visibility,
                    $property->getName(),
                    null,
                    null,
                    null
                );
                $classDefinition->addProperty($classProperty);
            }
        }

        $classDefinition->setIsBundled(true);

        return $classDefinition;
    }
1170297
private function isPropertyAccessible($name, \ReflectionClass $class)
    {
        $camelized = $this->camelize($name);
        $setter = 'set'.$camelized;
        $getsetter = lcfirst($camelized); // jQuery style, e.g. read: last(), write: last($item)
        $classHasProperty = $class->hasProperty($name);

        if ($this->isMethodAccessible($class, $setter, 1)
            || $this->isMethodAccessible($class, $getsetter, 1)
            || $this->isMethodAccessible($class, '__set', 2)
            || ($classHasProperty && $class->getProperty($name)->isPublic())) {
            return true;
        }

        $singulars = (array) StringUtil::singularify($camelized);

        // Any of the two methods is required, but not yet known
        if (null !== $this->findAdderAndRemover($class, $singulars)) {
            return true;
        }

        return false;
    }
661802
public function extract(\Reflector $reflectionClass)
    {
        if (!$reflectionClass instanceof \ReflectionClass) {
            throw new ExtractorException(\ReflectionClass::class, $reflectionClass);
        }

        return $this->reader->getClassAnnotations($reflectionClass);
    }
1212341
public function classify(ReflectionClass $class)
    {
        $mergedClassifiers = array_merge(
            self::DEFAULT_CLASSIFIER,
            config('stats.custom_component_classifier', [])
        );

        foreach ($mergedClassifiers as $classifier) {
            $c = new $classifier();

            if (! $this->implementsContract($classifier)) {
                throw new Exception("Classifier {$classifier} does not implement ".ClassifierContract::class.'.');
            }

            try {
                $satisfied = $c->satisfies($class);
            } catch (Exception $e) {
                $satisfied = false;
            }

            if ($satisfied) {
                return $c->getName();
            }
        }

        return 'Other';
    }
821395
private function supports($class)
    {
        $class = new \ReflectionClass($class);
        $methods = $class->getMethods(\ReflectionMethod::IS_PUBLIC);
        foreach ($methods as $method) {
            if ($this->isGetMethod($method)) {
                return true;
            }
        }

        return false;
    }
678577
protected function isSkip(ReflectionClass $reflecter): bool
    {
        $skips = array_filter(
            $this->skips,
            function ($value) {
                return $value === 1;
            }
        );

        foreach ($skips as $name => $value) {
            $method = 'is' . ucfirst($name);

            if ($reflecter->$method()) {
                return true;
            }

            unset($method);
        }

        unset($skips);

        return false;
    }
1113262
protected function getInstance(ReflectionClass $parameterClass)
    {
        if (!class_exists($parameterClass->name, true)) {
            return null;
        }
        
        if (strpos($parameterClass->name, 'Zepi\\Turbo\\') === 0) {
            return $this->getFrameworkInstance($parameterClass);
        }
        
        if ($parameterClass->isInstantiable()) {
            return $this->framework->getInstance($parameterClass->name);
        }
    }
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);
    }
755978
public function loadMetadataForClass(\ReflectionClass $class)
    {
        $classMetadata = new MergeableClassMetadata($class->getName());

        foreach ($class->getProperties() as $reflectionProperty) {
            $propertyMetadata = new PropertyMetadata($class->getName(), $reflectionProperty->getName());

            /** @var $annotation \Zicht\Bundle\FileManagerBundle\Annotation\File */
            $annotation = $this->reader->getPropertyAnnotation(
                $reflectionProperty,
                'Zicht\Bundle\FileManagerBundle\Annotation\File'
            );
            if (null !== $annotation) {
                // a "@DefaultValue" annotation was found
                $propertyMetadata->fileManager = $annotation->settings;
            }

            $classMetadata->addPropertyMetadata($propertyMetadata);
        }

        return $classMetadata;
    }
1292201
private function has(\ReflectionClass $class, $annotation): bool
    {
        $count = 0;
        foreach ($class->getMethods(\ReflectionMethod::IS_PUBLIC) as $reflectionMethod) {
            $match = $this->reader->getMethodAnnotation($reflectionMethod, $annotation);
            if ($match) {
                $count++;
            }
        }
        if ($count > 1) {
            return false;
        }

        return true;
    }
1333059
public function parse(\ReflectionClass $class)
    {
        $className = $class->getName();

        if ($class->isTrait()) {
            return false;
        }

        if (!isset($this->documents[$className])) {
            /** @var Document $document */
            $document = $this->reader->getClassAnnotation($class, self::DOCUMENT_ANNOTATION);

            if ($document === null) {
                throw new MissingDocumentAnnotationException(
                    sprintf(
                        '"%s" class cannot be parsed as document because @Document annotation is missing.',
                        $class->getName()
                    )
                );
            }

            $fields = [];
            $aliases = $this->getAliases($class, $fields);

            $this->documents[$className] = [
                'type' => $document->type ?: Caser::snake($class->getShortName()),
                'properties' => $this->getProperties($class),
                'fields' => array_filter(
                    array_merge(
                        $document->dump(),
                        $fields
                    )
                ),
                'aliases' => $aliases,
                'analyzers' => $this->getAnalyzers($class),
                'objects' => $this->getObjects(),
                'namespace' => $class->getName(),
                'class' => $class->getShortName(),
            ];
        }
        return $this->documents[$className];
    }
1225303
public function supports(\stdClass $data, \ReflectionClass $reflection)
    {
        $constructor       = $reflection->getConstructor();
        $constructorParams = $constructor->getParameters();

        $invalidParams = array_filter(
            $constructorParams,
            function($param) use ($data) {
                $name = $param->getName();
                if ($param->isDefaultValueAvailable()|| property_exists($data, $name)) {
                    return false;
                } else {
                    return true;
                }
            }
        );

        return count($invalidParams) > 0 ? false : true;
    }