Get a factory instance by name.

@param string $name

@return \NotifyMeHQ\Contracts\FactoryInterface
192829
public function factory($name)
    {
        if (isset($this->factories[$name])) {
            return $this->factories[$name];
        }

        if (class_exists($class = $this->inflect($name))) {
            return $this->factories[$name] = new $class();
        }

        throw new InvalidArgumentException("Unsupported factory [$name].");
    }
291782
protected function getHandlerInstanceByName($name){
        $config = (isset($this->config[$name]) ? $this->config[$name] : []);
        return Factory::create($name,$config,$this->title);
    }
755734
public function make($name, array $args = [])
    {
        if (! isset($this->classes[$name])) {
            throw new FactoryException('"' . $name . '" is not a registered class');
        }

        $class = new \ReflectionClass($this->classes[$name]);

        return $class->newInstanceArgs($args);
    }
805080
public static function getInstance($name)
    {
        if (!isset(static::$instances[$name])) {
            static::$instances[$name] = new CacheInstance();
        }
        return static::$instances[$name];
    }
85658
public static function create($name)
    {
        $class = App::className($name, 'Middleware/UnauthorizedHandler', 'Handler');
        if (!$class) {
            $message = sprintf('Handler `%s` does not exist.', $name);
            throw new RuntimeException($message);
        }

        $instance = new $class();
        if (!$instance instanceof HandlerInterface) {
            $message = sprintf('Handler should implement `%s`, got `%s`.', HandlerInterface::class, get_class($instance));
            throw new RuntimeException($message);
        }

        return $instance;
    }
204036
public static function getInstance($cloneInstance = false): Factory
	{	
		if ($cloneInstance === true || self::$cloneInstances === true)
		{
			return clone self::$sharedFactoryInstance;
		}

		return self::$sharedFactoryInstance;
	}
530530
public static function getInstance($name)
    {
        if (!isset(static::$instance[strtolower($name)])) {
            $name = ucfirst($name);

            static::$instance[strtolower($name)] = sprintf(__NAMESPACE__ . '\%s\%sGrammar', $name, $name);
        }

        return static::$instance[strtolower($name)];
    }
661608
static function factory($name = 'default') {
        $class = get_called_class();
        if (!isset(self::$instances[$class][$name])) {
            self::$instances[$class][$name] = new $class($name);
        }

        return self::$instances[$class][$name];
    }
1211692
public function getFactory($name)
    {
        if (!isset($this->factories[$name])) {
            throw new \RuntimeException(sprintf('No factory registered with name "%s"', $name));
        }

        return $this->factories[$name];
    }
724894
public function getInstanceDescriptor($name) {
		if (isset($this->instanceDescriptors[$name])) {
			return $this->instanceDescriptors[$name];
		} elseif (isset($this->declaredInstances[$name])) {
			$this->instanceDescriptors[$name] = new MoufInstanceDescriptor($this, $name);
			return $this->instanceDescriptors[$name];
		} else {
			throw new MoufContainerException("Instance '".$name."' does not exist.");
		}
	}
1111610
public function get(string $name)
    {
        if ($this->isSingleton($name)) {
            /*
             * Object is instantiated as
             * singleton already. Just fetch it.
             */
            return $this->singletonObjects[$name];
        } elseif ($this->isDefined($name)) {
            /*
             * Creates a new instance
             * using map information.
             */
            return $this->build($name);
        } elseif (class_exists($name)) {
            /*
             * Class exists but it is
             * not mapped yet.
             */
            $this->set(
                $name,
                method_exists($name, '__construct') ?
                    $this->generateArgumentsMap($name) : []
            );

            return $this->get($name);
        }

        throw new \Exception("Couldn't create '$name'");
    }
22119
public static function get($name)
    {
        $class = get_called_class();
    
        if (!isset(self::$instance[$class])) {
            self::$instance[$class] = new static();
        }
        
        return self::$instance[$class]->getExtensions()->get($name);
    }
356122
public static function getInstance($name)
    {
        if (is_null(self::$instance)) {
            $arr = explode('.', $name);
            $company = $arr[0];
            $type = $arr[1];
            $className = self::$map[$company][$type];
            self::$instance = new $className;
        }

        return self::$instance;
    }
948528
protected function _getInstance($name)
    {
        $this->loadModel('Field.FieldInstances');
        $instance = $this->FieldInstances
            ->find()
            ->contain(['EavAttribute'])
            ->where(['EavAttribute.name' => $name])
            ->first();

        if (!$instance) {
            $this->_error(__d('field', 'Invalid field instance.'), 504);
        }

        return $instance;
    }
520574
public function getService($name)
    {
        if (!$this->serviceManager) {
            throw new Exception\UndefinedReferenceException('Cannot get service without an service manager instance!');
        }

        return $this->serviceManager->get($name);
    }
1336992
public static function getInstance(string $name): \Swoole\Table
    {
        if(!static::$isInited)
        {
            throw new \RuntimeException('getInstance failed, MemoryTableManager is not initialized');
        }
        if(!isset(static::$tables[$name]))
        {
            throw new \RuntimeException(sprintf('GetInstance failed, %s is not found', $name));
        }
        return static::$tables[$name];
    }
744891
public function get(string $name)
    {
        $name = $this->getDefinitiveName($name);

        if (!$this->has($name)) {
            $instance = $this->build($name);
            $this->store($instance);
        }

        return $this->instances[$name];
    }