public function getReflectionClass($class, $throw = true)
    {
        if (!$class = $this->getParameterBag()->resolveValue($class)) {
            return;
        }

        if (isset(self::$internalTypes[$class])) {
            return null;
        }

        $resource = null;

        try {
            if (isset($this->classReflectors[$class])) {
                $classReflector = $this->classReflectors[$class];
            } elseif ($this->trackResources) {
                $resource = new ClassExistenceResource($class, false);
                $classReflector = $resource->isFresh(0) ? false : new \ReflectionClass($class);
            } else {
                $classReflector = new \ReflectionClass($class);
            }
        } catch (\ReflectionException $e) {
            if ($throw) {
                throw $e;
            }
            $classReflector = false;
        }

        if ($this->trackResources) {
            if (!$classReflector) {
                $this->addResource($resource ?: new ClassExistenceResource($class, false));
            } elseif (!$classReflector->isInternal()) {
                $path = $classReflector->getFileName();

                if (!$this->inVendors($path)) {
                    $this->addResource(new ReflectionClassResource($classReflector, $this->vendors));
                }
            }
            $this->classReflectors[$class] = $classReflector;
        }

        return $classReflector ?: null;
    }