Returns a md5 signature of a segment of the configuration object
that uniquely identifies that particular configuration
@note Revision is handled specially and is removed from the batch
before processing!
@param $namespace Namespace to get serial for
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];
    }
129573
public function getPath (string $namespace) : string
    {
        if (!isset($this->namespaces[$namespace]))
        {
            throw new AssetsException(sprintf(
                "Unknown entry namespace: '%s'",
                $namespace
            ));
        }

        return $this->namespaces[$namespace];
    }
1084974
public function invalidate($namespace)
	{
		if($this->prefix) {
			$namespace = $this->prefix.$this->delimiter.$namespace;
		}

		return $this->mapper->invalidate($namespace);
	}
978456
protected function getClient($namespace) {
		$path = sprintf('%s/configs/%s/%s/%s?releaseKey=%s',
			$this->conf['path'],
			$this->conf['appid'],
			$this->conf['cluster'],
			$this->conf['namespace'],
			$this->last_key);
		if ($this->conf['with_ip']) {
			$cidr = Container::getInstance()->get(CIDRmatch::class);
			foreach (swoole_get_local_ip() as $v) {
				if ($cidr->match($v, $this->conf['with_ip'])) {
					$path .= '&ip=' . $v;
					break;
				}
			}
		}
		$cli = new Client($this->conf['host'], $this->conf['port']);
		$cli->set([
			'timeout' => 1
		]);
		$cli->setDefer();
		$cli->get($path);
		return $cli;
	}
80468
public function get($key, $namespace = null)
    {
        return null !== $namespace ? $this->offsetGet([$namespace => $key]) : $this->offsetGet($key);
    }
362197
public function getModuleConfig(string $namespace) {
		if (array_key_exists($namespace, $this->moduleConfigs)) {
			return $this->moduleConfigs[$namespace];
		}
		
		$module = $this->moduleManager->getModuleByNs($namespace);
		if ($module->hasConfigDescriber()) {
			return $this->moduleConfigs[$namespace] = $module->createConfigDescriber($this)->buildCustomConfig();
		}
		
		return $this->moduleConfigs[$namespace] = null;
	}
526715
public function findByNamespace($namespace)
    {
        if (!$this->hasPlugin($namespace)) {
            return null;
        }

        $classId = $this->getIdentifier($namespace);

        return $this->plugins[$classId];
    }
43564
protected function getNamespacesFromClass($namespace)
    {
        $classStack = [$namespace];
        $classStack = array_merge($classStack, class_parents($namespace));
        $classStack = array_merge($classStack, class_implements($namespace));

        return $classStack;
    }
487137
public static function createV3($namespace, $name) {
    // If the namespace is not a valid UUID we throw an error.
    if (!self::isValid($namespace)) {
      throw new Exception('The UUID provided for the namespace is not valid.');
    }

    $bin = self::bin($namespace);

    $hash = md5($bin . $name);

    return new self (sprintf('{%08s-%04s-%04x-%04x-%12s}',

      // 32 bits for "time_low"
      substr($hash, 0, 8),

      // 16 bits for "time_mid"
      substr($hash, 8, 4),

      // 16 bits for "time_hi_and_version",
      // four most significant bits holds version number 3
      (hexdec(substr($hash, 12, 4)) & 0x0fff) | 0x3000,

      // 16 bits, 8 bits for "clk_seq_hi_res",
      // 8 bits for "clk_seq_low",
      // two most significant bits holds zero and one for variant DCE1.1
      (hexdec(substr($hash, 16, 4)) & 0x3fff) | 0x8000,

      // 48 bits for "node"
      substr($hash, 20, 12)
    ), self::V3, $namespace, $name);

  }
459465
public function ns($nameSpace)
    {
        // If ! exist try to load a configuration file 
        if ( !isset($this->nameSpaces[$nameSpace]) ) {
            // short sanitize of nameSpace
            if (!filter_var( $nameSpace,FILTER_VALIDATE_REGEXP, 
                array('options'=>array('regexp' => '/^[\w]+$/')))) {
                    throw new InvalidArgumentException("Invalid configuration name.",400);
            }
            $this->nameSpaces[$nameSpace] = new ContextNameSpace($this->loadArrayFromIniFile($nameSpace));
        }
        
        return $this->nameSpaces[$nameSpace];
    }
840787
protected static function uuid5($namespace, string $name): Uuid
    {
        if (!($namespace instanceof self)) {
            $namespace = static::parse($namespace);
        }

        $hash = sha1($namespace->toBytes().$name);

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

        return self::toString(self::uuidFromHashedName($hex, 4));
    }
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;
    }
1305022
public function getDescriptor(string $classNamespace): ?Descriptor
    {
        if (!$this->isEmpty()) {
            /** @var Descriptor $descriptor */
            foreach ($this as $rootNamespace => $descriptor) {
                $rootNamespace = $descriptor->getRootNamespace();

                $doubleSlashed = str_replace('\\', '\\\\', $rootNamespace);
                $pattern = sprintf('|^%s\\.*|', $doubleSlashed);

                if (preg_match($pattern, $classNamespace)) {
                    return $descriptor;
                }
            }
        }

        return null;
    }
1131338
protected function isNamespaceValid($namespace)
    {
        if ($namespace === '\\') {
            return true;
        }

        if (strpos($namespace, '\\') === 0) {
            $namespace = substr($namespace, 1);
        }

        $parts = explode('\\', $namespace);
        foreach ($parts as $part) {
            $match = preg_match(self::PATTERN_VALIDATE_NAMESPACE_NAME, $part);
            if ($match === false || $match <= 0 || ReservedKeywords::isReservedKeyword($part) !== false) {
                return false;
            }
        }

        return true;
    }
337193
protected function getFileName(string $namespace, string $hash): string
    {
        $fileName = implode(DIRECTORY_SEPARATOR, [
            $this->directory,
            $namespace,
            substr($hash, 0, 2),
            $hash
        ]);
        return $fileName;
    }
1286613
public function findNamespace($namespace)
    {
        $allNamespaces = $this->getNamespaces();
        $expr = preg_replace_callback('{([^:]+|)}', function ($matches) { return preg_quote($matches[1]).'[^:]*'; }, $namespace);
        $namespaces = preg_grep('{^'.$expr.'}', $allNamespaces);

        if (empty($namespaces)) {
            $message = sprintf('There are no commands defined in the "%s" namespace.', $namespace);

            if ($alternatives = $this->findAlternatives($namespace, $allNamespaces)) {
                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 CommandNotFoundException($message, $alternatives);
        }

        $exact = in_array($namespace, $namespaces, true);
        if (count($namespaces) > 1 && !$exact) {
            throw new CommandNotFoundException(sprintf("The namespace \"%s\" is ambiguous.\nDid you mean one of these?\n%s", $namespace, $this->getAbbreviationSuggestions(array_values($namespaces))), array_values($namespaces));
        }

        return $exact ? $namespace : reset($namespaces);
    }