Sets the fully-qualified name of the factory class.

@param string $className The fully-qualified class name.

@return static The current instance.
498820
public function setClassName($className)
    {
        Assert::stringNotEmpty($className, 'The class name must be a non-empty string. Got: %s');

        $pos = strrpos($className, '\\');

        if (false === $pos) {
            $this->namespaceName = '';
            $this->shortClassName = $className;
        } else {
            $this->namespaceName = substr($className, 0, $pos);
            $this->shortClassName = substr($className, $pos + 1);
        }

        return $this;
    }
1137280
public function getClassAliasName($className)
    {
        /*
         * Sanitize input: class names in namespaces should not, but may include a leading backslash
         */
        $className = ltrim($className, '\\');
        $classAlias = array_search($className, $this->classMap);

        if ($classAlias === false) {
            $classAlias = null;
        }

        return $classAlias;
    }
573332
private function buildFactory(string $className) : callable
    {
        $reflectionClass = $this->getReflectionClass($className);

        if ($this->isInstantiableViaReflection($reflectionClass)) {
            return [$reflectionClass, 'newInstanceWithoutConstructor'];
        }

        $serializedString = sprintf(
            '%s:%d:"%s":0:{}',
            self::SERIALIZATION_FORMAT_AVOID_UNSERIALIZER,
            strlen($className),
            $className
        );

        $this->checkIfUnSerializationIsSupported($reflectionClass, $serializedString);

        return static function () use ($serializedString) {
            return unserialize($serializedString);
        };
    }
937967
public function setDefaultRepositoryClassName($className)
    {
        $reflectionClass = new \ReflectionClass($className);

        if (!$reflectionClass->implementsInterface(ObjectRepository::class)) {
            throw new \InvalidArgumentException(sprintf(
                'Invalid repository class "%s". It must be a Doctrine\Common\Persistence\ObjectRepository.',
                $className
            ));
        }

        $this->repositoryClassName = $className;
    }
913391
protected function make($className) {
        $refl = new ReflectionClass($className);
        $deps = $this->getDependencies($refl);

        if (empty($deps)) {
            return $refl->newInstance();
        }

        $resolvedDeps = array_map([$this, 'resolveDependency'], $deps);

        return $refl->newInstanceArgs($resolvedDeps);
    }
1158492
public static function getInstance($className)
    {
        if (!isset(self::$instances[$className])) {
            self::$instances[$className] = new self($className);
        }

        return self::$instances[$className];
    }
1074512
public static function deNamespace($className)
        {
            $className = trim($className, '\\');

            if ($lastSeparator = strrpos($className, '\\')) {
                $className = substr($className, $lastSeparator + 1);
            }

            return $className;
        }
59044
public function setDefaultRepositoryClassName($className)
    {
        $reflectionClass = new \ReflectionClass($className);

        if ( ! $reflectionClass->implementsInterface('Doctrine\Common\Persistence\ObjectRepository')) {
            throw ORMException::invalidEntityRepository($className);
        }

        $this->_attributes['defaultRepositoryClassName'] = $className;
    }
328516
public function setUserClass(string $classname)
    {
        if (!class_exists($classname) || !is_subclass_of($classname, UserInterface::class))
            throw new DomainException("Invalid user class: $classname");
        $this->user_class = $classname;
        return $this;
    }
313404
public function setModelName($modelName) {
    
    if (!class_exists($modelName))
      throw new Exception("Model '{$modelName}' could not be found");
    
    $model = new \ReflectionClass($modelName);
    
    if (!$model->implementsInterface('\Phalcon\Mvc\ModelInterface'))
      throw new Exception("'{$modelName}' must be an instance of Phalcon\Mvc\ModelInterface");
    
    $this->modelname = $modelName;
    return $this;
  }
1203243
public function remove($className)
    {
        if (!is_string($className)) {
            throw new InvalidArgumentException(sprintf('%s expects parameter 1 to be string, %s given', __METHOD__, (is_object($className) ? get_class($className) : gettype($className))));
        }

        $this->parseClassAttribute();

        $classIndex = array_search($className, $this->classes);

        if ($classIndex === false) {
            return $this;
        }

        unset($this->classes[$classIndex]);

        $this->updateClassAttribute();

        return $this;
    }
541286
protected static function getObject($className)
    {
        if (!isset(self::$instances[$className])) {
            self::$instances[$className] = self::createObject($className);
        }

        return self::$instances[$className];
    }
1026959
public static function factory($name)
    {
        $classname = get_called_class();

        if (!isset(self::$instances[$classname])) {
            self::$instances[$classname] = array();
        }

        if ($name instanceof Value) {
            $name = $name->getValue();
        }

        if (!isset(self::$instances[$classname][$name])) {
            $instance = new static($name);
            $name = $instance->getName();

            if (!isset(self::$instances[$classname][$name])) {
                self::$instances[$classname][$name] = $instance;
            }
        }

        return self::$instances[$classname][$name];
    }
1172535
public function setQueryClass($className)
    {
        if ($this->queryClass !== $className && !$this->isQueryOrScan()) {
            throw ODMException::queryOperationAlreadySet($this->queryClass);
        }

        $this->queryClass = $className;

        return $this;
    }
331343
public function cloneInstance($className): self
	{
		// Determine the class to load
		$instanceName = strtolower($className);

		if (!isset($this->{$instanceName}))
		{
			throw new FactoryException("Could not clone instance of '".$instanceName."'. Instance was not found.", 1);
		}

		// Clone the instance
		$this->{$instanceName} = clone $this->{$instanceName};

		// Return itself
		return $this;
	}
71835
public function forClass($className) {
        $parents = $this->getParents($className);
        $finalConfig = array();
        foreach ($parents as $parent) { // child will overwrite parent config for selected options;
            if (isset($this->options[$parent]) && count($this->options[$parent])) {
                foreach ($this->options[$parent] as $name => $option)
                    $finalConfig[$name] = $option;
            }
        }
        return $finalConfig;
    }
1342728
public static function fromClassName($className): self
    {
        return new self(\sprintf(
            'Exclude class name should be a string, got "%s" instead.',
            \is_object($className) ? \get_class($className) : \gettype($className)
        ));
    }