@param string|null $namespace
@param string|null $name

@return string
429371
public static function create($namespace = null, $name = null)
    {
        $bytes = self::generateBytes(16);
        $hex   = \bin2hex($bytes);

        return self::toString(self::uuidFromHashedName($hex, 4));
    }
502703
private function createServiceName(string $namespace)
	{
		$parts = explode('\\', $namespace);
		foreach ($parts as $k => $part) {
			$parts[$k] = lcfirst($part);
		}
		return trim(implode('.', $parts), '.');
	}
816174
public function getPathFromNamespace($namespace, $base = null)
    {
        $appNamespace = $this->getAppNamespace();

        // remove the app namespace from the namespace if it is there
        if (substr($namespace, 0, strlen($appNamespace)) == $appNamespace) {
            $namespace = substr($namespace, strlen($appNamespace));
        }

        $path = str_replace('\\', '/', trim($namespace, ' \\'));

        // trim and return the path
        return ($base ?: app_path()).'/'.$path;
    }
401756
public function load(string $namespace, string $hash): ?string
    {
        $result = null;
        $fileName = $this->getFileName($namespace, $hash);
        if (file_exists($fileName) && is_readable($fileName)) {
            $result = file_get_contents($fileName);
        }
        return is_string($result) ? $result : null;
    }
503685
public function getTaxonomyForNamespace( $namespace )
	{
		if ( ! isset( $this->context->importedSchemas[ $namespace ] ) )
		{
			if ( XBRL::endsWith( $namespace, '/' ) )
			{
				$namespace = substr( $namespace, 0, strlen( $namespace ) - 1 );
			}
			else if ( ! XBRL::endsWith( $namespace, '/' ) )

			{
				$namespace .= '/';
			}
			if ( ! isset( $this->context->importedSchemas[ $namespace ] ) )
			{
				return false;
			}
		}

		return $this->context->importedSchemas[ $namespace ];
	}
305640
public static function v3(string $namespace, string $name): string
	{
		$hash = md5(self::toBinary($namespace) . $name);

		return sprintf
		(
			'%s-%s-%x-%x-%s',
			substr($hash, 0, 8),
			substr($hash, 8, 4),
			(hexdec(substr($hash, 12, 4)) & 0x0fff) | 0x3000,
			(hexdec(substr($hash, 16, 4)) & 0x3fff) | 0x8000,
			substr($hash, 20, 12)
		);
	}
1227589
public function renderClass($name = null, $namespace = null)
    {
        if ($namespace === null) {
            $namespace = $this->renderProperty('google', 'maps');
        }

        if (empty($namespace)) {
            return $name;
        }

        return $this->renderProperty($namespace, $name);
    }
561006
public String childValue(String name, String namespace) {
        for (XNElement e : children) {
            if (Objects.equals(e.name, name) && Objects.equals(e.namespace, namespace)) {
                return e.content;
            }
        }
        return null;
    }
1076232
protected function getControllerName($name, $namespace)
    {
        if (empty($namespace)) {
            return $name;
        }

        $path = Helpers::postFixWith($namespace, '\\');

        return Helpers::convertSlashToBackslash($path . $name);
    }
753175
private function methodInvoke($name, $namespace)
    {
        $name = ucfirst($name);

        $this->uses[] = $namespace . '\\' . $name;

        $namespace = '\\' . $namespace . '\\';

        $parameters = [
            new ParameterGenerator(
                'command', $namespace . $name
            ),
        ];

        return new MethodGenerator(
            '__invoke',
            $parameters,
            MethodGenerator::FLAG_PUBLIC,
            '',
            new DocBlockGenerator(
                'Handle command',
                null,
                [
                    new ParamTag('command', [ $namespace . $name]),
                ]
            )
        );
    }
4950
public static function getNamespaceDefaultClass($namespace, $defaultNamespace) {
        if (strpos($namespace, $defaultNamespace) === 0) {
            $namespace = substr($namespace, strlen($defaultNamespace));
        }

        $defaults = self::$_config['defaults'];
        $controller = $defaults[str_replace('\\', '/', $namespace)];

        if (!$controller) {
            $controller = $defaults['*'] ? $defaults['*'] : 'Index';
        }

        return $controller;
    }
49620
public static function extractNamespaceFromQualifiedName($name)
    {
        if (($pos = strrpos($name, '\\')) !== false) {
            return substr($name, 0, $pos);
        } else {
            return null;
        }
    }
827188
public function remove($name, $namespace = null)
    {
        // Get previous value
        $value = $this->get($name, null, $namespace);

        // Set value
        $this->set($name, null, $namespace);

        // Return old value
        return $value;
    }
1145641
public static function getNamespace($tokens)
    {
        $count = count($tokens);
        $i = 0;
        $namespace = '';
        $namespace_ok = false;
        while ($i < $count) {
            $token = $tokens[$i];
            if (is_array($token) && $token[0] === T_NAMESPACE) {
                // Found namespace declaration
                while (++$i < $count) {
                    if ($tokens[$i] === ';') {
                        $namespace_ok = true;
                        $namespace = trim($namespace);
                        break;
                    }
                    $namespace .= is_array($tokens[$i]) ? $tokens[$i][1] : $tokens[$i];
                }
                break;
            }
            $i++;
        }
        if (!$namespace_ok) {
            return null;
        } else {
            return $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;
    }
718821
protected function getFromNameAndNs($namespace, $name, $hash)
    {
        $nhex = str_replace(array('-','{','}'), '', $namespace);
        $nstr = '';

        for($i = 0; $i < strlen($nhex); $i+=2)
		{
			$nstr .= chr(hexdec($nhex[$i].$nhex[$i+1]));
		}

        return $hash($nstr . $name);
    }
1360115
static function getInstance($namespace = null) {

        $namespace = is_null($namespace) ? static::NAMESPACE_DEFAULT : $namespace;

        if (!array_key_exists($namespace, static::$instances)) {
            self::$instances[$namespace] = new static();
        }

        return self::$instances[$namespace];
    }