Factory method which retrieves an instance of the named generator.

@param string $name The fully qualified class name of the name
generation algorithm to retrieve.
357076
protected static function getAlgorithm($name)
    {
        if (!isset(self::$algorithms[$name])) {
            self::$algorithms[$name] = new $name();
        }

        return self::$algorithms[$name];
    }
608585
public static function getInstance($name = 'default')
    {
        if (isset(static::$instances[$name])) {
            return static::$instances[$name];
        }

        $instance = new static();

        static::$instances[$name] = $instance;

        return $instance;
    }
1297817
protected function getFixture($name)
    {
        // The user may provide either a class name or a short
        // name identifier. So we'll track it down here.

        foreach ($this->fixtures as $fixture) {
            if ($fixture->shortName == $name) {
                return $fixture;
            }

            if ($fixture->name == $name && ! $fixture->shortName) {
                return $fixture;
            }
        }

        throw new TestDummyException(
            'Could not locate a factory with the name: ' . $name
        );
    }
1005853
protected function getClassName($name) {
        if (empty($name)) {
            throw new $this->_factoryExceptionClassName ('$name must not be empty');
        }

        $result = $this->getFactoryNamespace() . '\\' . $name . $this->getFactoryPostfix();

        if (!class_exists($result)) {
            throw new $this->_factoryExceptionClassName ('Class "' . $result . '" does not exist');
        }

        return $result;
    }
1250521
protected function retrieveClass($name)
    {
        if (!$this->enumExists($name)) {
            $this->enums[$name] = $this->buildClass($name);
        }

        return $this->enums[$name];
    }
1079230
public function getModel(string $name = '')
    {
        if (empty($name)) {
            $name = $this->getComponentsName();
        }

        // Create a model instance from a different app?
        $model = $this->MVCFactory($name, 'Model');

        return $model;
    }
415132
private function createTaxon($name)
    {
        /** @var TaxonInterface $taxon */
        $taxon = $this->taxonFactory->createNew();
        $taxon->setName($name);
        $taxon->setCode(StringInflector::nameToCode($name));
        $taxon->setSlug($this->taxonSlugGenerator->generate($taxon));

        return $taxon;
    }
80699
static function ByCreationMethod($name)
    {
        $enumClass = new \ReflectionClass(get_class());
        $calledClass = get_called_class();
        $reflectionClass = new \ReflectionClass($calledClass);
        $methods = $reflectionClass->getMethods(\ReflectionMethod::IS_STATIC);
        foreach ($methods as $method)
        {
            if ($method->name != $name)
                continue;
            
            if ($method->isPublic() && $method->getNumberOfParameters() == 0)
            {
                if (!$enumClass->hasMethod($method->name))
                {
                    $result = $method->invoke(null);
                    if (get_class($result) == $calledClass)
                        return $result;
                }
            }
        }
        throw new \InvalidArgumentException("'Creation method '$name' not found");
    }
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)];
    }
1175297
public static function getInstance($name=null) {
		if( !$name ) {
			$name = 'default';
		}
		if( !isset(static::$instances[$name]) ) {
			static::make($name);
		}
		return static::$instances[$name];
	}
1045882
final public static function byName(string $name)
    {
        if (isset(self::$instances[static::class][$name])) {
            return self::$instances[static::class][$name];
        }

        $const = static::class . "::{$name}";
        if (!\defined($const)) {
            throw new InvalidArgumentException("{$const} not defined");
        }

        return self::$instances[static::class][$name] = new static(\constant($const));
    }
16412
static function getInstance($name = null)
  {
    if (empty($name)) {
      $name = get_called_class();
    }
    if (!empty(static::$plugins[$name])) {
      return static::$plugins[$name];
    }
    return false;
  }
1359097
static public function instance($name=null)
    {
        $options = $name ? ['name' => $name] : [];
        $name = $name ?: get_called_class();
        
        if (!isset(static::$instances[$name])) {
            static::$instances[$name] = new static($name);
        }
        
        return static::$instances[$name];
    }
1160366
public static function factory($name)
    {
        if (!isset(self::$services[$name])) {
            throw new \RuntimeException("The service [$name] don't register.");
        }

        $service = self::$services[$name];

        if (\is_object($service) && method_exists($service, '__invoke')) {
            return $service();
        }

        return $service;
    }
45763
public function getHelper($name)
    {
        if (! $this->hasHelper($name)) {
            throw new Exceptions\HelperNotFound($name);
        }

        if (! isset($this->helpers[$name])) {
            $factory = $this->helperMap[$name];
            $this->helpers[$name] = $factory();
        }

        return $this->helpers[$name];
    }
1069353
public function generateSvg( $name = null ) {
		if ( $name !== null ) {
			$this->name               = $name;
			$this->generated_initials = $this->initials_generator->keepCase( $this->getKeepCase() )->generate( $name );
		}

		return $this->makeSvgAvatar();
	}
288369
public function get($name)
    {
        $instance = self::getInstance();
        if (!$instance->offsetExists($name)) {
            throw new \RuntimeException(sprintf('Class %s Not Found', $name));
        }

        return $instance->offsetGet($name);
    }