Get config of a plugin

@param  $namespace
@return mixed
@throws \Exception
482161
public static function config($namespace)
    {
        $configPath = pluginsPath($namespace.'/config.json');
        if(file_exists($configPath)) {
            return json_decode(File::get($configPath));
        }
        throw  new \Exception("No config.json file found for plugin ".$configPath);
    }
423172
public function evaluateEntityNamespace(string $namespace)
    {
        /**
         * Trying to generate new entity given that the class is the entity
         * namespace.
         */
        if (class_exists($namespace)) {
            return $namespace;
        }

        /**
         * Trying to generate new entity given that the namespace is defined in
         * as a Container parameter.
         */
        $container = $this->container;
        if (
            $container->hasParameter($namespace) &&
            class_exists($container->getParameter($namespace))
        ) {
            $namespaceParameter = $container->getParameter($namespace);

            return $namespaceParameter;
        }

        $resolvedNamespace = explode(':', $namespace, 2);
        $bundles = $this->kernel->getBundles();

        /**
         * Trying to get entity using Doctrine short format.
         *
         * MyBundle:MyEntity
         *
         * To accept this format, entities must be at Entity/ folder in the
         * bundle root dir
         *
         * /MyBundle/Entity/MyEntity
         *
         * If entity definition is wrong, throw exception
         * If bundle not exists or is not actived, throw Exception
         */
        if (
        !(
            isset($resolvedNamespace[0]) &&
            isset($bundles[$resolvedNamespace[0]]) &&
            $bundles[$resolvedNamespace[0]] instanceof Bundle &&
            isset($resolvedNamespace[1])
        )
        ) {
            throw new ClassNotFoundException(
                $namespace,
                new ErrorException()
            );
        }

        /**
         * @var Bundle $bundle
         */
        $bundle = $bundles[$resolvedNamespace[0]];
        $bundleNamespace = $bundle->getNamespace();
        $namespace = $bundleNamespace . '\\Entity\\' . $resolvedNamespace[1];

        if (!class_exists($namespace)) {
            throw new ClassNotFoundException(
                $namespace,
                new ErrorException()
            );
        }

        /**
         * Otherwise, assume that class is namespace of class.
         */

        return $namespace;
    }
1119968
public function getTemplatePath($namespace)
    {
        if (!$this->hasTemplatePath($namespace)) {
            throw new \RuntimeException("Path with namespace \"".$namespace."\" is not exist");
        }

        $path = $this->paths[$namespace];

        if (!is_dir($path)) {
            throw new \RuntimeException("Invalid template path with namespace \"".$namespace."\"");
        }

        return $path;
    }
306795
protected function newDoctrineCacheImpl($namespace)
    {
        $config  = $this->get('config');
        $factory = $config->get('psx_cache_factory');

        if ($factory instanceof \Closure) {
            return $factory($config, $namespace);
        } else {
            return new DoctrineCache\FilesystemCache($this->get('config')->get('psx_path_cache') . '/' . $namespace);
        }
    }
913339
final public function get($varname, $namespace = 'default')
    {
        //gets a registry var, stored in a namespace of this session id
        $session = $this;

        if (!isset($namespace) || empty($namespace)) {
            //@TODO Throw an exception, we need a name or use the default;
            return false;
        }

        //@TODO, check if the regitry is not locked before adding
        $registry = $session->getNamespace($namespace);

        return $registry->get($varname);
    }
1156232
public function getFrom($namespace, $key = null, $default = null)
    {
        if (isset($_SESSION[$namespace])) {
            $oldNamespace = $this->namespace;
            $this->setNamespace($namespace);
            $result = $this->get($key, $default);
            $this->setNamespace($oldNamespace);

            return $result;
        }
        return $default;
    }
758319
public function load($environment, $namespace)
    {

        //evironments = /config/<environment>/namespace.ini[section].key
        $file = $this->directory;
        $file .= !empty($environment) ? $environment . DS : DS;
        $file .= $namespace;
        $file .= $this->extension;


        //Check that we have a file named namespace
        if (!array_key_exists($this->extension, $this->handlers)) {
            throw new \Exception("config file handler for {$this->extension} does not exists");
        }


        $handler = $this->handlers[$this->extension];
        $params = $handler->readParams($file);


        return $params;
    }
1222151
public function getAlert($namespace)
    {

        $messagesToPrint = $this->getView()->plugin('flash_messenger')->render($namespace);

        if (empty($messagesToPrint)) {
            return null;
        }

        $alert = $this->getView()->plugin('sxb_alert')->__invoke($messagesToPrint);

        if (in_array($namespace, $this->availableNamespaces)) {

            if (PluginFlashMessenger::NAMESPACE_DEFAULT === $namespace) {
                $namespace = PluginFlashMessenger::NAMESPACE_INFO;
            }

            $alert->$namespace();
        }

        if ($this->isBlock) {
            $alert->block();
        }

        return $alert;
    }
253169
public function findControllerNamespace($namespace)
	{
	    $prefixs = $this->getControllerNamespaces();
	    
	    $expr          = preg_replace_callback('{([^:]+|)}', function ($matches) {
	        return preg_quote($matches[1]) . '[^:]*';
	    }, $namespace);
	    
	    $find_names = preg_grep('{^' . $expr . '}', $prefixs);
        
	    if (empty($find_names)) {
	        $message = sprintf('There are no controllers defined in the "%s" namespace.', $namespace);
            
	        if ($alternatives = $this->findAlternatives($namespace, $prefixs)) {
                if (1 == count($alternatives)) {
                    $message .= "\n\nDid you mean this?\n    ";
                } else {
                    $message .= "\n\nDid you mean one of these?\n    ";
                }
                
                $message .= implode("\n    ", $alternatives);
            }
            
            throw new \InvalidArgumentException($message);
        }
        
        $exact = in_array($namespace, $find_names, true);
        if (count($find_names) > 1 && !$exact) {
            throw new \InvalidArgumentException(sprintf('The namespace "%s" is ambiguous (%s).', $namespace, $this->getAbbreviationSuggestions(array_values($find_names))));
        }
        
        return $exact ? $namespace : reset($find_names);
	}
240802
protected function getClassNamesInNamespace($namespace)
    {
        $affectedViewHelperClassNames = array();

        $allViewHelperClassNames = $this->reflectionService->getAllSubClassNamesForClass(\TYPO3\Fluid\Core\ViewHelper\AbstractViewHelper::class);
        foreach ($allViewHelperClassNames as $viewHelperClassName) {
            if ($this->reflectionService->isClassAbstract($viewHelperClassName)) {
                continue;
            }
            if (strncmp($namespace, $viewHelperClassName, strlen($namespace)) === 0) {
                $affectedViewHelperClassNames[] = $viewHelperClassName;
            }
        }
        sort($affectedViewHelperClassNames);
        return $affectedViewHelperClassNames;
    }
233538
protected function checkOverrider($namespace)
    {
        if ($this->allowOverride && isset($this->overrides[$namespace])) {
            $oldNamespace = $namespace;

            $namespace = $this->overrides[$namespace]['overrider'];
            $this->classExists($namespace);

            if ($this->overrides[$oldNamespace]['only_once']) {
                $this->unsetOverrider($oldNamespace);
            }
        }

        return $namespace;
    }
608705
def get_namespace(name):
    
    if name not in configuration_namespaces:
        configuration_namespaces[name] = ConfigNamespace(name)
    return configuration_namespaces[name]
1282938
public function setNamespace($namespace)
    {
        $parts = explode('/', $namespace);

        foreach ($parts as &$part) {
            $part = $this->toSnakeCase($part, '-');
        }

        $namespace = implode('/', $parts);
        $namespace = '/' . trim($namespace, '/');
        $this->namespace = $namespace;

        return $this;
    }
900851
protected function validateNamespace($namespace)
    {
        switch ($namespace) {
            case 'ns:DNS':
                return Uuid::NAMESPACE_DNS;
                break;
            case 'ns:URL':
                return Uuid::NAMESPACE_URL;
                break;
            case 'ns:OID':
                return Uuid::NAMESPACE_OID;
                break;
            case 'ns:X500':
                return Uuid::NAMESPACE_X500;
                break;
        }

        if (Uuid::isValid($namespace)) {
            return $namespace;
        }

        throw new Exception(
            'Invalid namespace. '
            . 'May be either a UUID in string representation or an identifier '
            . 'for internally pre-defined namespace UUIDs (currently known '
            . 'are "ns:DNS", "ns:URL", "ns:OID", and "ns:X500").'
        );
    }
874489
public function getDefaultInstanceConfig($pluginName)
    {
        $blockConfig = $this->blockConfigRepository->findById($pluginName);

        if (empty($blockConfig)) {
            throw new \Exception('Block config not found for ' . $pluginName); //@TODO throw custom exception class
        }

        return $blockConfig->getDefaultConfig();
    }
736443
public function getAutoloaderConfig()
    {
        $dir = $this->getDir();
        $namespace = $this->getModuleNamespace();
    
        if (file_exists($dir . '/../../src')) {
            $dir = $dir . '/../../src';
        } elseif (file_exists($dir . '/../src')) {
            $dir = $dir . '/../src';
        } elseif (file_exists($dir . '/src')) {
            $dir = $dir . '/src';
        } else {
            throw new \Exception('No src directory found');
        }
    
        return array(
            'Zend\Loader\StandardAutoloader' => array(
                'namespaces' => array(
                    $namespace => $dir . '/' . $namespace,
                ),
            ),
        );
    }
1089578
static function setCache($namespace)
    {
        $cacheData = [];
        $data = CommonConfigModel::getConfigByNamespace($namespace);
        foreach ($data as $key => $value) {
            $cacheData[$value['name']] = [
                'value'=>self::_getInfo($value['vtype'], $value['value']),
                'issystem'=>$value['issystem'],
                'desc'=>$value['desc']
            ];
        }
        $cacheName = 'config:'.$namespace;
        Cache::forever($cacheName, $cacheData);
        return $cacheData;
    }