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;
    }
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;
    }
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 ; }
Retrieves the requested reflection class and registers it for resource tracking.

@param string $class
@param bool   $throw

@return \ReflectionClass|null

@throws \ReflectionException when a parent class/interface/trait is not found and $throw is true

@final
Retrieves the requested reflection class and registers it for resource tracking .