Returns the target instance of the static proxy.

This function is called from Statical\BaseProxy to resolve proxy targets.

@param string $class
@throws RuntimeException
@return mixed
347543
public function getProxyTarget($class)
    {
        if (!isset($this->registry[$class])) {
            throw new \RuntimeException($class.' not registered as a static proxy.');
        }

        if ($id = $this->registry[$class]['id']) {
            return call_user_func_array($this->registry[$class]['target'], array($id));
        } else {

            if ($closure = $this->registry[$class]['closure']) {
                $this->registry[$class]['target'] = $closure();
                $this->registry[$class]['closure'] = null;
            }

            return $this->registry[$class]['target'];
        }
    }
888133
protected function findProxyFile(string $class): ?string
    {
        $class = substr($class, 24);

        $filePath = $this->directory . '/Proxy/' . str_replace('\\', '/', $class) . '.php';

        if (file_exists($filePath) && is_file($filePath)) {
            return $filePath;
        }

        return null;
    }
106862
public function offsetGet($class)
	{
		if (!isset($this->factories[$class]) && !isset($this->instances[$class])) {
			throw new \InvalidArgumentException("$class has not been defined");
		}

		if (isset($this->instances[$class])) {
			return $this->instances[$class];
		}

		array_push($this->resolving, $class);
		$object = $this->invoke($this->factories[$class]);
		array_pop($this->resolving);

		return $object;
	}
147167
public function get($class) {
		if (isset($this->aliases[$class])) {
			$class = $this->aliases[$class];
		}

		if (isset($this->resolvingClasses[$class])) {
			throw new CyclicDependencyException("Cyclic dependency detected when resolving $class");
		}

		$this->resolvingClasses[$class] = true;

		if (array_key_exists($class, $this->factories)) {
			$instance = $this->getFactory($class);
		} else {
			$instance = $this->getSingleton($class);
		}

		unset($this->resolvingClasses[$class]);

		return $instance;
	}
334553
public function load(string $class): HydratorInterface
    {
        if (isset($this->hydrators[$class])) {
            return $this->hydrators[$class];
        }

        /** @var ClassMetadata $classMetadata */
        $classMetadata = $this->metadataFactory->getMetadataForClass($class);

        if (null === $classMetadata) {
            throw new \RuntimeException(
                'No mapping file was found for class '.$class.
                '. Did you configure the correct paths for serializer?'
            );
        }

        $fqn = $this->configuration->getFQNClassName($classMetadata);

        if (\class_exists($fqn, false)) {
            return $this->hydrators[$class] = $this->factory->newInstance($classMetadata);
        }

        $this->compileAndLoad($classMetadata);

        return $this->hydrators[$class] = $this->factory->newInstance($classMetadata);
    }
134412
public function getSpecificSubclassMapping(string $class): self
    {
        if ($this->class->getClassName() === $class) {
            return $this;
        }

        if (!is_subclass_of($class, $this->class->getClassName(), true)) {
            throw InvalidArgumentException::format(
                'Invalid class supplied to %s: must be a subclass of %s, %s given',
                __METHOD__, $this->class->getClassName(), $class
            );
        }

        foreach ($this->subClassMappings as $mapping) {
            if (is_subclass_of($class, $mapping->getDefinition()->getClassName(), true)) {
                return $mapping->getDefinition()->getSpecificSubclassMapping($class);
            }
        }

        throw InvalidArgumentException::format(
            'Invalid class supplied to %s: cannot find mapping for %s',
            __METHOD__, $class
        );
    }
1153892
public function createInstance(string $class)
    {
        $refClass = new \ReflectionClass($class);
        $args = [];
        if ($refClass->getConstructor()) {
            foreach ($refClass->getConstructor()->getParameters() as $parameter) {
                $name = Inflector::tableize(str_replace('_', '.', $parameter->getName()));
                $dependency = null;
                if ($parameter->getClass()) {
                    if ($this->container->has($parameter->getClass()->getName())) {
                        $dependency = $this->container->get($parameter->getClass()->getName());
                    } elseif ($this->container->has($name)) {
                        $dependency = $this->container->get($name);
                    }
                } elseif ($this->container->hasParameter($name)) {
                    $dependency = $this->container->getParameter($name);
                }
                $args[] = $dependency;
            }
        }

        return $refClass->newInstanceArgs($args);
    }
505906
protected function getSingleton($class) {
		if (isset($this->singletons[$class])) {
			return $this->singletons[$class];
		}

		$instance = $this->getNewInstance($class);
		$this->singletons[$class] = $instance;
		return $instance;
	}
747762
public function findFile($class)
    {
        $findFile = $this->_findFile;
        $file = static::originalInstance()->{$findFile}($class);
        if ($file !== false) {
            $file = realpath($file);
        }
        return $this->_patchers->findFile($this, $class, $file);
    }
962888
public function get($class)
    {
        $class = ltrim($class, '\\');

        if (!isset($this->sharedInstances[$class])) {
            $this->sharedInstances[$class] = $this->create($class);
        }
        return $this->sharedInstances[$class];
    }
580606
public function getExtendedClass($class)
    {
        $ret = null;
        if (array_key_exists($class, $this->dynamicClasses)) {
            $ret = $this->dynamicClasses[$class];
        }
        if (!$ret) {
            $ret = array_search($class, $this->classes);
        }
        return $ret?$ret:null;
    }
893267
protected function executeStatic(string $class) : string
    {
        list($class, $method) = explode('::', $class);
        if (!class_exists($class)) {
            throw new \RuntimeException('could not find class: ' . $class);
        }
        if (!method_exists($class, $method)) {
            throw new \RuntimeException('could not find method in class: ' . $method);
        }
        ob_start();
        $class::$method();
        return (string)ob_get_clean();
    }
852419
public function get(string $class, array $parameters = [], bool $reuseInstance = true): object
	{
		$class = $this->resolveAlias($class);

		// If a singleton instance exists then we'll just return it

		if($reuseInstance && isset($this->instances[$class]))
		{
			return $this->instances[$class];
		}

		// Create new instance

		$instance = $this->factory($this->resolveHint($class), $parameters);

		// Store the instance if its registered as a singleton

		if($reuseInstance && isset($this->hints[$class]) && $this->hints[$class]['singleton'])
		{
			$this->instances[$class] = $instance;
		}

		// Return the instance

		return $instance;
	}
735082
public function fetchFirstObj(string $class = null)
    {
        if (!$this->wasExecuted()) {
            $this->exec();
        }

        $data = $this->fetchFirst();

        if ($data === null) {
            return null;
        }

        if ($class == null) {
            $obj = new \stdClass();

            foreach ($data as $field => $value) {
                $obj->$field = $value;
            }

            return $obj;
        } else {
            return new $class($data);
        }
    }
1018825
public static function getInstance($class = null)
    {
        $reflector = null;

        if (class_exists($class)) {
            throw new \Exception(sprintf('Class %s not found', $class));
        }

        $reflector = new ReflectionClass('\\'.$class);

        return new $reflector->name();
    }
1196210
public function gateway($class = null)
    {
        $class = $class ?: $this->getDefaultGateway();

        if (!isset($this->gateways[$class])) {
            $gateway = $this->factory->create($class);
            $gateway->initialize($this->getConfig($class));
            $this->gateways[$class] = $gateway;
        }

        return $this->gateways[$class];
    }
780664
public function findFile($class)
    {
        return $this->finder->findFile($class, $this->prefixPaths, $this->basePaths, $this->useIncludePath);
    }