@param string|null $namespace

@return string
774839
public function getModuleNameByNamespace($namespace = null)
    {
        $defaultNamespace = 'app';
        $currentRoute = app('router')->getCurrentRoute();

        if (is_null($namespace) and !is_null($currentRoute)) {
            $namespace = $currentRoute->getAction()['namespace'];
        }

        if (is_null($namespace)) {
            return $defaultNamespace;
        }

        foreach ($this->moduleLoader->getRegisteredModules() as $module) {
            if (!empty($moduleNamespace = $module->getNamespace())) {
                if (strpos($namespace, $moduleNamespace) === 0) {
                    return $module->getKey();
                }
            }
        }

        return $defaultNamespace;
    }
502703
private function createServiceName(string $namespace)
	{
		$parts = explode('\\', $namespace);
		foreach ($parts as $k => $part) {
			$parts[$k] = lcfirst($part);
		}
		return trim(implode('.', $parts), '.');
	}
115059
public function namespace(string $namespace, string $alias = null) : Manager
    {
        $this->namespaces[] = [trim($namespace, '\\'), trim($alias, '\\')];

        return $this;
    }
516513
public function getBatchSerial($namespace) {
        if (empty($this->serials[$namespace])) {
            $batch = $this->getBatch($namespace);
            unset($batch['DefinitionRev']);
            $this->serials[$namespace] = md5(serialize($batch));
        }
        return $this->serials[$namespace];
    }
59076
public function render($namespace = null)
    {
        $messagesToPrint = '';

        // get messages from each namespace.
        if (null === $namespace) {
            foreach ($this->classMessages as $namespace => $class) {
                $messagesToPrint .= $this->fetchMessagesFromNamespace($namespace);
            }
        } else {
            $messagesToPrint .= $this->fetchMessagesFromNamespace($namespace);
        }

        return $messagesToPrint;
    }
841536
protected static function & _namespaceGet($namespace, $name = null)
    {
        if (self::$_readable === false) {
            /**
             * @see Zend_Session_Exception
             */
            require_once 'Zend/Session/Exception.php';
            throw new Zend_Session_Exception(self::_THROW_NOT_READABLE_MSG);
        }

        if ($name === null) {
            if (isset($_SESSION[$namespace])) { // check session first for data requested
                return $_SESSION[$namespace];
            } elseif (isset(self::$_expiringData[$namespace])) { // check expiring data for data reqeusted
                return self::$_expiringData[$namespace];
            } else {
                return $_SESSION[$namespace]; // satisfy return by reference
            }
        } else {
            if (isset($_SESSION[$namespace][$name])) { // check session first
                return $_SESSION[$namespace][$name];
            } elseif (isset(self::$_expiringData[$namespace][$name])) { // check expiring data
                return self::$_expiringData[$namespace][$name];
            } else {
                return $_SESSION[$namespace][$name]; // satisfy return by reference
            }
        }
    }
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;
    }
90470
public function getNamespace($ns) {
    $namespaces = $this
      ->getNamespaces()
      ->filter(function(NamespaceNode $node) use ($ns) {
        return $node->getName()->getPath() === $ns;
      });

    return $namespaces->isEmpty() ? NULL : $namespaces[0];
  }
43564
protected function getNamespacesFromClass($namespace)
    {
        $classStack = [$namespace];
        $classStack = array_merge($classStack, class_parents($namespace));
        $classStack = array_merge($classStack, class_implements($namespace));

        return $classStack;
    }
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];
    }
90779
public function toPhpString(
        $namespace,
        array $aliased_classes,
        $this_class,
        $php_major_version,
        $php_minor_version
    ) {
        if ($this->value === 'static') {
            return null;
        }

        return $this->toNamespacedString($namespace, $aliased_classes, $this_class, false);
    }
375112
public static function v5(string $namespace, string $name): string
	{
		$hash = sha1(static::toBinary($namespace) . $name);

		return sprintf
		(
			'%s-%s-%x-%x-%s',
			substr($hash, 0, 8),
			substr($hash, 8, 4),
			(hexdec(substr($hash, 12, 4)) & 0x0fff) | 0x5000,
			(hexdec(substr($hash, 16, 4)) & 0x3fff) | 0x8000,
			substr($hash, 20, 12)
		);
	}
1154700
public function findNamespace(string $namespace): string
	{
		$allNamespaces = $this->getNamespaces();

		$expr = preg_replace_callback(
			'{([^:]+|)}',
			function ($matches)
			{
				return preg_quote($matches[1]) . '[^:]*';
			},
			$namespace
		);

		$namespaces = preg_grep('{^' . $expr . '}', $allNamespaces);

		if (empty($namespaces))
		{
			throw new NamespaceNotFoundException(sprintf('There are no commands defined in the "%s" namespace.', $namespace));
		}

		$exact = \in_array($namespace, $namespaces, true);

		if (\count($namespaces) > 1 && !$exact)
		{
			throw new NamespaceNotFoundException(sprintf('The namespace "%s" is ambiguous.', $namespace));
		}

		return $exact ? $namespace : reset($namespaces);
	}
214711
public function getMapping($namespace)
    {
        $cacheName = 'ongr.metadata.document.'.md5($namespace);

        $namespace = $this->getClassName($namespace);
        $this->enableCache && $mapping = $this->cache->fetch($cacheName);

        if (isset($mapping) && false !== $mapping) {
            return $mapping;
        }

        $mapping = $this->getDocumentReflectionMapping(new \ReflectionClass($namespace));

        $this->enableCache && $this->cache->save($cacheName, $mapping);

        return $mapping;
    }
753977
protected static function formatNamespaceGroup(array $namespace, $group)
    {
        $group = static::checkGroup($group);

        if ('any' === $group) {
            $namespace = ['*'];
        } else {
            foreach ($namespace as &$value) {
                $value = static::checkNamespace($value);
                if ('path' === $group) {
                    $value .= '\\*';
                }
            }
        }

        return $namespace;
    }
1325847
public function getPrefixForNamespace( $namespace )
	{
		if (
			  ! isset( $this->cacheNamespaces ) ||
			  count( $this->cacheNamespaces ) != count( $this->instance_namespaces )
		   )
		{
			$this->cacheNamespaces = array_flip( $this->instance_namespaces );
			// If the default namespace is one of the standards ones then the prefix may be missing
			$standardNamespaces = array_flip( XBRL_Constants::$standardPrefixes );
			if ( isset( $this->instance_namespaces[''] ) )
			{
				if ( isset( $standardNamespaces[ $this->instance_namespaces[''] ] ) )
				{
					$this->cacheNamespaces[ $this->instance_namespaces[''] ] = $standardNamespaces[ $this->instance_namespaces[''] ];
				}
			}
		}

		return isset( $this->cacheNamespaces[ $namespace ] )
			? $this->cacheNamespaces[ $namespace ]
			: false;
	}
114387
final public function getNamespace(): string
    {
        if (null === $this->namespace) {
            $pos             = strrpos(static::class, '\\');
            $this->namespace = false === $pos ? '' : substr(static::class, 0, $pos);
        }

        return $this->namespace;
    }