Get store based on application.ini

@param string $namespace A global namespace for your data.
@param string $type Pick a type of store manually
@return Garp_Store_Interface
358782
public static function getStore($namespace, $type = null) {
        $ini = Zend_Registry::get('config');
        if (is_null($type)) {
            $type = !empty($ini->store->type) ? $ini->store->type : 'Cookie';
        }
        $type = ucfirst($type);
        if (!in_array($type, array('Session', 'Cookie'))) {
            throw new Garp_Store_Exception(
                'Invalid Store type selected. Must be Session or Cookie.'
            );
        }

        $duration = false;
        if (isset($ini->store->lifetime)) {
            $duration = $ini->store->lifetime;
        }

        $className = 'Garp_Store_' . $type;
        $obj = new $className($namespace, $duration);
        return $obj;
    }
702589
public static function get($type, array $options)
    {
        if (self::TYPE_STASH == $type) {
            $cache = new StashCache();
        } elseif (self::TYPE_DOCTRINE == $type) {
            $cache = new DoctrineCache();
        } elseif (self::TYPE_NONE == $type) {
            $cache = new NoCache();
        } else {
            throw new InvalidArgumentException(sprintf('Unknown cache type "%s".', $type));
        }
        $cache->setOptions($options);

        return $cache;
    }
127490
protected function initService(string $type, string $alias, array $options)
    {
        $id      = $this->resolverFactory->resolve($type, $alias);
        $service = $this->get($id);
        
        $service->setOptions($options);
        
        return $service;
    }
543510
public function getNamespace($namespace, $documentsDirectory = null)
    {
        if (!$documentsDirectory) {
            $documentsDirectory = $this->documentDir;
        }

        if (strpos($namespace, ':') !== false) {
            list($bundle, $document) = explode(':', $namespace);
            $bundle = $this->getBundleClass($bundle);

            // If bundle has a sub-namespace it needs to be replaced
            if (strpos($documentsDirectory, '\\')) {
                $bundleSubNamespace = substr(
                    $bundle,
                    $start = strpos($bundle, '\\') + 1,
                    strrpos($bundle, '\\') - $start + 1
                );

                $documentsDirectory = str_replace(
                    $bundleSubNamespace,
                    '',
                    $documentsDirectory
                );
            }

            $namespace = substr($bundle, 0, strrpos($bundle, '\\')) . '\\' .
                $documentsDirectory . '\\' . $document;
        }

        return $namespace;
    }
382779
public function getBatch($namespace)
    {
        if (!$this->finalized) {
            $this->autoFinalize();
        }
        $full = $this->getAll();
        if (!isset($full[$namespace])) {
            $this->triggerError(
                'Cannot retrieve undefined namespace ' .
                htmlspecialchars($namespace),
                E_USER_WARNING
            );
            return;
        }
        return $full[$namespace];
    }
1213189
public static function get($type)
    {
        if (!isset(static::$_modelFactories['Table'])) {
            static::$_modelFactories['Table'] = [TableRegistry::getTableLocator(), 'get'];
        }

        if (!isset(static::$_modelFactories[$type])) {
            throw new InvalidArgumentException(sprintf(
                'Unknown repository type "%s". Make sure you register a type before trying to use it.',
                $type
            ));
        }

        return static::$_modelFactories[$type];
    }
621493
protected function createGetter($name, Type $type, $namespace)
    {
        return new Stmt\ClassMethod(
            // getProperty
            $this->getNaming()->getPrefixedMethodName('get', $name),
            [
                // public function
                'type' => Stmt\Class_::MODIFIER_PUBLIC,
                'stmts' => [
                    // return $this->property;
                    new Stmt\Return_(
                        new Expr\PropertyFetch(new Expr\Variable('this'), $this->getNaming()->getPropertyName($name))
                    ),
                ],
            ], [
                'comments' => [$this->createGetterDoc($type, $namespace)],
            ]
        );
    }
531787
public function getData($namespace = null)
    {
        if(!self::$pluginData) {
            // try to find the model via namespace
            if (!$namespace) {
                // if we are in a model
                if (property_exists($this, 'namespace')) {
                    self::$pluginData = $this;
                } /// When calling the method from a parent class that uses this class as a parent
                else {
                    // try to find plugin's model via reflection class
                    try{
                        $reflector = new \ReflectionClass(self::class);
                        $fn = $reflector->getFileName();
                        $explode = explode('plugins/', str_replace('\\', '/', dirname($fn)));
                        if (isset($explode[1])) {
                            $pluginNamespace = str_replace('/Controllers', '', $explode[1]);
                            self::$pluginData = Plugin::where('namespace', $pluginNamespace)->first();
                        }

                    }catch(\Exception $e){
                        return null;
                    }
                }
            }else {
                // Return a requested plugin
                self::$pluginData = $this->getByNamespace($namespace);
            }
        }

        if (!self::$pluginData) {
            return null;
        }

        return self::$pluginData;
    }
360499
public function setNamespace($namespace)
	{
	    $this->namespace = rtrim($namespace, '\\');
	    
	    // set autoload
	    if ($this->namespace) {
	        Ioc::loader()->setPsr4($this->namespace, $this->basePath . 'src');
	    }
	    
	    return $this;
	}
257707
static public function getNamespaces($type=null)
	{
	    static::initNamespace();
	    
	    if ($type) {
	        $nss = [];
	        foreach (static::$namespaces as $k => $v) {
	            $nss[$k] = $v . ucfirst($type) . '\\';
	        }
	        return $nss;
	    } else {
	        return static::$namespaces;
	    }
	}
80468
public function get($key, $namespace = null)
    {
        return null !== $namespace ? $this->offsetGet([$namespace => $key]) : $this->offsetGet($key);
    }
193026
public static function getInstance(Garp_Store_Interface $store = null) {
        if (!Garp_Auth::$_instance) {
            Garp_Auth::$_instance = new Garp_Auth($store);
        }
        return Garp_Auth::$_instance;
    }
116317
public static function getInstance($type, $init) 
    {

        if (!self::$cachingInstance) {
            self::$cachingInstance = new IDS_Caching_Session($type, $init);
        }

        return self::$cachingInstance;
    }
1220008
public function loadFromRequest(Request $request, $namespace = '', $type = null) {
        if (null === $type) {
            $type = $this->getType();
        }

        $this->_load($request, $type, $namespace);
        $bag = $this->getBagByType($request, $this->getType());

        $fields = $this->getProtectedVars();
        $vars = $this->getVars($bag, $namespace);
        foreach ($fields as $field) {
            $val = array_key_exists($field, $vars) ? $vars[$field] : null;
            if ($val) {
                $this->$field = $val;
            }
        }

        return $this;
    }
350862
public static function get(string $type): AbstractReader
    {
        if (!\array_key_exists($type, static::$invokableClasses)) {
            throw new InvalidArgumentException('Unsupported config file type: '.$type);
        }

        return new static::$invokableClasses[$type];
    }
669864
public static function getResource(string $type)
    {
        if (isset(self::$resources[$type])) {
            return self::$resources[$type];
        }
        $class = '\\sdopx\\resource\\' . Utils::toCamel($type) . 'Resource';
        if (class_exists($class)) {
            self::$resources[$type] = new $class();
            return self::$resources[$type];
        }
        return null;
    }
1106969
private function getInstaller($type)
    {
        if (!isset($this->installers[$type])) {
            return false;
        }

        return $this->installers[$type];
    }