Get plugin extension instance.

@param   string $name Plugin name.
@return  Entity
164664
public static function getInstance($name)
    {
        if (!self::loaded($name)) {
            throw new MissingPluginException(['plugin' => $name]);
        }

        if (!Arr::key($name, self::$_pluginsList)) {
            $slug  = Str::low($name);
            $table = TableRegistry::get('Extensions.Extensions');

            $entity = $table
                ->find()
                ->where([
                    'slug' => $slug,
                    'type' => EXT_TYPE_PLUGIN
                ])
                ->first();

            self::$_pluginsList[$name] = $entity;
        }

        return self::$_pluginsList[$name];
    }
980108
public function plugin($name, array $options = [])
    {
        $plugins = $this->getPluginManager();
        return $plugins->get($name, $options);
    }
73043
protected function instance($name)
    {
        $methodName = $this->methodName($name);

        return $this->objectBuild($name, $methodName);
    }
281334
public function getExtension(
        /*# string */ $extensionName
    )/*# : ExtensionAbstract */ {
        if (!$this->hasExtension($extensionName)) {
            $this->addExtension(new $extensionName);
        }
        return $this->extensions[$extensionName];
    }
547772
private function getExtension($name)
	{
		if (class_exists('Twig_Extensions_Extension_' . $name)) {
			$name = 'Twig_Extensions_Extension_' . $name;
		}
		elseif (class_exists('Twig_Extensions_Extension_' . ucfirst(strtolower($name)))) {
			$name = 'Twig_Extensions_Extension_' . ucfirst(strtolower($name));
		}
		elseif (!class_exists($name)) {
			throw new InvalidConfigException('Twig extension "' . $name . '" not declared.');
		}
		return new $name();
	}
856861
public static function getPluginByName($name) {

		$db = Database::getInstance();
		$db->setQuery('SELECT * FROM `templates` WHERE name=?');
		$obj = $db->loadObject($name);
		return (is_a($obj, 'stdClass') ? new Template($obj) : NULL);
		
	}
1036429
private function getTypeByName($name)
    {
        if (isset($this->types[$name])) {
            return $this->doctrine
                ->getRepository('AnimeDbCatalogBundle:Type')
                ->find($this->types[$name]);
        }
    }
611457
public function getExtensionConfig($name)
    {
        if (!isset($this->extensionConfigs[$name])) {
            $this->extensionConfigs[$name] = [];
        }

        return $this->extensionConfigs[$name];
    }
254726
public function extension_loaded($name)
    {
        $code = new Code();
        $code->addStatement(sprintf(
            "return extension_loaded(%s);",
            var_export($name, true)
        ));

        return $this->adapter->run($code);
    }
1115029
public static function getInstance(string $name)
    {
        if (!isset(self::$instances[$name]) || empty(self::$instances[$name])) {
            new static($name);
        }
        return (self::$instances[$name]);
    }
524548
public function extend($name, ExtensionInterface $extension)
    {
        $this->getExtensions()->put($name, $extension);

        $extension->set($this);

        return $extension;
    }
824300
public function get($name)
    {
        if (!$this->has($name)) {
            throw new MissingPluginException(['plugin' => $name]);
        }

        return $this->plugins[$name];
    }
247604
public function removeExtension($name)
    {
        if (isset($this->extensions[$name])) {
            unset($this->extensions[$name]);
        }

        return $this;
    }
645484
public function quessByName(string $name)
    {
        return $this->first(function(ExtensionContract $extension) use($name) {
            $package = $extension->getPackageName();

            return (str_contains($package, 'module-')) ? $package === 'module-' . $name : $package === 'component-' . $name;
        });
    }
16412
static function getInstance($name = null)
  {
    if (empty($name)) {
      $name = get_called_class();
    }
    if (!empty(static::$plugins[$name])) {
      return static::$plugins[$name];
    }
    return false;
  }
794441
public function getWebservice($name)
    {
        if (!isset($this->_webservices[$name])) {
            list($pluginName) = pluginSplit(App::shortName(get_class($this), 'Webservice/Driver'));

            $webserviceClass = implode('.', array_filter([$pluginName, Inflector::camelize($name)]));

            $webservice = $this->_createWebservice($webserviceClass, [
                'endpoint' => $name,
                'driver' => $this,
            ]);

            $this->_webservices[$name] = $webservice;
        }

        return $this->_webservices[$name];
    }
176408
public static function entityManager($name = 'default')
    {
        if (isset(self::$entityManagers[$name])) {
            return self::$entityManagers[$name];
        }
        $databaseConnection = self::connection($name)->getDbalConnection();

        if (Configuration::get('app.env') == 'development') {
            $cache = new ArrayCache();
        } else { // @codeCoverageIgnore
            $cache = new FilesystemCache(Configuration::get('app.cache')); // @codeCoverageIgnore
        }

        $config = new \Doctrine\ORM\Configuration();
        $config->setMetadataCacheImpl($cache);
        $driver = $config->newDefaultAnnotationDriver([APPPATH . 'Entity'], false);

        $config->setMetadataDriverImpl($driver);
        $config->setQueryCacheImpl($cache);

        $proxyDir = APPPATH . 'Proxy';
        $proxyNamespace = 'App\Proxy';

        $config->setProxyDir($proxyDir);
        $config->setProxyNamespace($proxyNamespace);
        Autoloader::register($proxyDir, $proxyNamespace);

        $loggerChain = new LoggerChain();
        if (Configuration::get('app.env') == 'development') {
            $config->setAutoGenerateProxyClasses(true);

            $loggerChain->addLogger(new DoctrineLogBridge(\Logger::getInstance()->getMonologInstance()));
            $loggerChain->addLogger(DebugBarHelper::getInstance()->getDebugStack());
        } else { // @codeCoverageIgnore
            $config->setAutoGenerateProxyClasses(false); // @codeCoverageIgnore
        }
        $em = EntityManager::create($databaseConnection, $config);

        $em->getConnection()->getConfiguration()->setSQLLogger($loggerChain);
        $em->getConfiguration()->setSQLLogger($loggerChain);

        self::$entityManagers[$name] = $em;
        return $em;
    }