Returns all hashes currently known to the adapter.
@param string $namespace
@return array|string[]
559226
public function getAllHashes(string $namespace): array
    {
        $directory = implode(DIRECTORY_SEPARATOR, [
            $this->directory,
            $namespace,
        ]);

        $result = [];
        if (is_dir($directory)) {
            $directoryIterator = new RecursiveDirectoryIterator(
                $directory,
                RecursiveDirectoryIterator::SKIP_DOTS
            );

            foreach (new RecursiveIteratorIterator($directoryIterator) as $file) {
                /* @var SplFileInfo $file */
                $result[] = $file->getFilename();
            }
        }
        return $result;
    }
344420
private function getContainer(string $namespace, int $version) : array
    {
        return [
             'swagger' => '2.0',
             'info' => [
               'title' => $namespace,
               'version' => $version . '.0',
             ],
             'host' => self::request()->getUri()->getHost(),
             'basePath' => '/Json/' . $namespace . '/v' . $version,
             'schemes' => [
                 self::request()->getUri()->getScheme(),
             ],
             'consumes' => [
                 'application/json',
             ],
             'produces' => [
               'application/json',
               'application/problem+json',
             ],
             'paths' => [],
             'securityDefinitions' => [
               'AuthApiKey' => [
                   'type' => 'apiKey',
                   'name' => 'APIKEY',
                   'in' => 'header',
               ],
               'AuthPassword' => [
                   'type' => 'basic',
               ],
             ],
             'definitions' => ['ApiException' => [
                   'required' => [
                     'status',
                     'message',
                   ],
                   'properties' => [
                     'status' => [
                       'type' => 'integer',
                     ],
                     'message' => [
                       'type' => 'string',
                     ],
                     'type' => [
                       'type' => 'string',
                     ],
                     'stack_trace' => [
                       'type' => 'array', 'items' => [
                         'type' => 'string',
                       ],
                     ],
                     'code' => [
                       'type' => 'integer',
                     ],
                     'detail' => [
                       'type' => 'string',
                     ],
                   ],
                 ],
             ],
           ];
    }
595201
public static function v3($namespace, $name)
    {
        if (!self::is_valid($namespace))
            return false;
        // Get hexadecimal components of namespace
        $nhex = str_replace(array('-', '{', '}'), '', $namespace);
        // Binary Value
        $nstr = '';
        // Convert Namespace UUID to bits
        for ($i = 0; $i < strlen($nhex); $i += 2) {
            $nstr .= chr(hexdec($nhex[$i] . $nhex[$i + 1]));
        }
        // Calculate hash value
        $hash = md5($nstr . $name);
        return 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)
        );
    }
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);
	}
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];
    }
585774
private function getByNamespace($namespace)
    {
        $this->checkForNonEmptyNamespace($namespace);

        if (!isset($this->configurations[$namespace])) {
            $this->configurations[$namespace]
                = $this->retrieveConfigurationFromTypoScriptSetup($namespace);
        }

        return $this->configurations[$namespace];
    }
131169
protected function getRulesForCustomFields($namespace)
    {
        $rules      = [];
        $brand      = antares('memory')->get('brand.default');
        $collection = app('antares.customfields.model.view')->query()->where('namespace', $namespace)->where('brand_id', $brand)->get();
        if ($collection->isEmpty()) {
            return $rules;
        }
        $collection->each(function($item) use(&$rules) {

            $validators = [];
            $item->config->each(function($config) use(&$validators) {
                $name          = $config->validator->name;
                $name == 'regex' && $config->value = implode('', ['[', $config->value, ']']);
                $rule          = ((!is_null($config->value) ? ':' . $config->value : ''));
                $validators[]  = $name . $rule;
            });

            $rules[$item->name] = $validators;
        });
        return $rules;
    }
234771
protected function listPackageClasses(array $namespaces)
    {
        return array_filter(get_declared_classes(), function ($class) use ($namespaces) {
            $valid = false;
            foreach ($namespaces as $ns) {
                $valid = (strpos($class, $ns) === 0) ? true : $valid;
            }
            return $valid;
        });
    }
1024210
public function getClassesInNamespace(string $namespace)
    {
        $arrOptions = [];

        foreach (get_declared_classes() as $strName) {
            if ($this->container->get('huh.utils.string')->startsWith($strName, $namespace)) {
                $arrOptions[$strName] = $strName;
            }
        }

        asort($arrOptions);

        return $arrOptions;
    }
854492
private function getParametersForNameSpace($namespace)
    {
        $parameters = array();
        foreach ($this->parameters as $key => $value) {
            if (0 === strpos($key, $namespace . ':')) {
                $parameters[substr($key, strlen($namespace) + 1)] = $value;
            }
        }
        return $parameters;
    }
1039309
def namedb_get_all_preordered_namespace_hashes( cur, current_block ):
    
    query = "SELECT preorder_hash FROM preorders WHERE op = ? AND block_number >= ? AND block_number < ?;"
    args = (NAMESPACE_PREORDER, current_block, current_block + NAMESPACE_PREORDER_EXPIRE )

    namespace_rows = namedb_query_execute( cur, query, args )
    ret = []
    for namespace_row in namespace_rows:
        ret.append( namespace_row['preorder_hash'] )

    return ret
954541
public function findByHashes(array $hashes): array
    {
        $result = [];
        if (count($hashes) > 0) {
            $queryBuilder = $this->entityManager->createQueryBuilder();
            $queryBuilder->select('if')
                         ->from(IconFile::class, 'if')
                         ->andWhere('if.hash IN (:hashes)')
                         ->setParameter('hashes', array_values(array_map('hex2bin', $hashes)));

            $result = $queryBuilder->getQuery()->getResult();
        }
        return $result;
    }
587391
def get_all_importing_namespace_hashes( self ):
        
        cur = self.db.cursor()
        namespace_hashes = namedb_get_all_importing_namespace_hashes( cur, self.lastblock )
        return namespace_hashes
172809
private function getNamespaceDirectory($namespace)
    {
        $composerNamespaces = $this->getDefinedNamespaces();

        $namespaceFragments = explode('\\', $namespace);
        $undefinedNamespaceFragments = [];

        while ($namespaceFragments) {
            $possibleNamespace = implode('\\', $namespaceFragments) . '\\';

            if (array_key_exists($possibleNamespace, $composerNamespaces)) {
                $path = app()->basePath() . DIRECTORY_SEPARATOR . $composerNamespaces[$possibleNamespace] . implode('/', array_reverse($undefinedNamespaceFragments));

                return realpath($path);
            }

            $undefinedNamespaceFragments[] = array_pop($namespaceFragments);
        }

        return false;
    }
152591
private function getNamespaces(string $locale): array
    {
        $result = $this->hasLocale($locale) === true ? array_keys($this->getBundles()[$locale]) : [];

        return $result;
    }
842165
public function getSubsetByHashes(array $hashes)
    {
        $subset = [];

        foreach ($this->items as $item) {
            $class = get_class($item);

            $mapper = Manager::getMapper($class);

            $keyName = $mapper->getEntityMap()->getKeyName();

            if (in_array($class.'.'.$item->$keyName, $hashes)) {
                $subset[] = $item;
            }
        }

        return $subset;
    }
216873
private function getPathMap (array $namespaces) : array
    {
        $pathMap = [];

        foreach ($namespaces as $namespace => $path)
        {
            $pathMap[$path] = 1 + ($pathMap[$path] ?? 0);
        }

        return $pathMap;
    }