@param string $namespace
@param int $version

@return array
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',
                     ],
                   ],
                 ],
             ],
           ];
    }
1173465
protected function getPackageInfo(Version $version, &$result)
    {
        $date           = new \DateTime($version->getTime());
        $packageVersion = $version->getVersion();
        if ($packageVersion === PackageHelperInterface::DEFAULT_BRANCH_VERSION) {
            $result[$packageVersion] = [
                'version'     => $packageVersion,
                'date'        => $date->format('Y-m-d H:i:s'),
                'authors'     => $version->getAuthors(),
                'description' => $version->getDescription(),
                'homepage'    => $version->getHomepage(),
                'license'     => $version->getLicense(),
            ];
        }
    }
561227
protected function loadNamespaceOverrides(array $lines, $locale, $group, $namespace)
	{
		$file = "{$this->path}/packages/{$locale}/{$namespace}/{$group}.php";

		if ($this->files->exists($file))
		{
			return array_replace_recursive($lines, $this->files->getRequire($file));
		}

		return $lines;
	}
1203212
public function getAllCommands(string $namespace = ''): array
	{
		$this->initCommands();

		if ($namespace === '')
		{
			$commands = $this->commands;

			if (!$this->commandLoader)
			{
				return $commands;
			}

			foreach ($this->commandLoader->getNames() as $name)
			{
				if (!isset($commands[$name]))
				{
					$commands[$name] = $this->getCommand($name);
				}
			}

			return $commands;
		}

		$commands = [];

		foreach ($this->commands as $name => $command)
		{
			if ($namespace === $this->extractNamespace($name, substr_count($namespace, ':') + 1))
			{
				$commands[$name] = $command;
			}
		}

		if ($this->commandLoader)
		{
			foreach ($this->commandLoader->getNames() as $name)
			{
				if (!isset($commands[$name]) && $namespace === $this->extractNamespace($name, substr_count($namespace, ':') + 1))
				{
					$commands[$name] = $this->getCommand($name);
				}
			}
		}

		return $commands;
	}
1243339
protected function loadMigrations(array $files, ?string $namespace) : array
    {
        $includedFiles = [];
        foreach ($files as $file) {
            static::requireOnce($file);

            $realFile = realpath($file);
            assert($realFile !== false);

            $includedFiles[] = $realFile;
        }

        $classes  = $this->loadMigrationClasses($includedFiles, $namespace);
        $versions = [];
        foreach ($classes as $class) {
            $version = substr($class->getShortName(), 7);

            if ($version === '0') {
                throw NameIsReserved::new($version);
            }

            $versions[$version] = $class->getName();
        }

        ksort($versions, SORT_STRING);

        return $versions;
    }
1042662
public function load($environment, $group, $namespace = null)
    {
        $result = array();

        $db = Database::getActiveConnection();
        $query = $db->createQueryBuilder();

        $query
            ->select('configValue', 'configItem')
            ->from('Config', 'c')
            ->where('configGroup = ?')
            ->setParameter(0, $group);

        if ($namespace) {
            $query->andWhere('configNamespace = ?')->setParameter(1, $namespace);
        } else {
            $query->andWhere('configNamespace = ? OR configNamespace IS NULL')->setParameter(1, '');
        }

        $results = $query->execute();

        while ($row = $results->fetch()) {
            array_set($result, $row['configItem'], $row['configValue']);
        }

        return $result;
    }
923325
private function getMetadataForNamespace($namespace)
    {
        $metadata = [];
        foreach ($this->getAllMetadata() as $m) {
            if (strpos($m->name, $namespace) !== 0) {
                continue;
            }

            $metadata[] = $m;
        }

        return new ClassMetadataCollection($metadata);
    }
891493
protected function generateSwagger(
        string $namespace,
        int $version,
        string $service = null,
        string $method = null
    ) : array {
        $this->listServices($namespace, $version, $service);
        $return = $this->getContainer($namespace, $version);

        foreach (self::$servicesList as $serviceName => $service) {
            list($path, $defintions) = $this->generateSwaggerForService($serviceName, $service, $method);
            $return['paths'] = array_merge($return['paths'], $path);
            $return['definitions'] = array_merge($return['definitions'], $defintions);
        }

        return $return;
    }
1307905
public function getConstraints($version)
    {
        if (!isset($this->constraints[$version])) {
            $this->constraints[$version] = $this->createConstraints($version);
        }

        return $this->constraints[$version];
    }
1045616
public function get(string $namespace = null, string $service = null, string $method = null, int $version = null)
    {
        return $this->masterpage->render();
    }
1279657
public function load($locale, $group, $namespace = null): array
    {
        $fileTranslations = parent::load($locale, $group, $namespace);

        if (! is_null($namespace) && $namespace !== '*') {
            return $fileTranslations;
        }

        $loaderTranslations = $this->getTranslationsForTranslationLoaders($locale, $group, $namespace);

        return array_replace_recursive($fileTranslations, $loaderTranslations);
    }
754860
private function getRepositoryUrlWithVersionPath($version)
    {
        $repositoryUrl = $this->repositoryUrl;
        if (in_array($version, array('master', $this->trunkPath))) {
            $repositoryUrl .= '/'.$this->trunkPath;
        } elseif (in_array($version, $this->getBranches())) {
            $repositoryUrl .= '/'.$this->branchesPath.'/'.$version;
        } elseif (in_array($version, $this->getTags())) {
            $repositoryUrl .= '/'.$this->tagsPath.'/'.$version;
        } else {
            return false;
        }

        return ProcessUtils::escapeArgument($repositoryUrl);
    }
379363
public function swagger(string $namespace, int $version, string $service = null, string $method = null) : array
    {
        $this->controlNamespace($namespace, $version);

        return $this->generateSwagger($namespace, $version, $service, $method);
    }
498408
public static function toComponents(Version $version)
    {
        return array(
            Parser::MAJOR => $version->getMajor(),
            Parser::MINOR => $version->getMinor(),
            Parser::PATCH => $version->getPatch(),
            Parser::PRE_RELEASE => $version->getPreRelease(),
            Parser::BUILD => $version->getBuild()
        );
    }
915855
public static function parse ($version)
    {
        $nums = explode(self::DELIMITER, $version);
        $numbers = array();
        foreach ($nums as $num) {
            if (preg_match('/^0*([0-9]+)/', $num, $matches)) {
                if (isset($matches[1])) {
                    $numbers[] = $matches[1];
                } else {
                    $numbers[] = 0;
                }
            } else {
                break;
            }
        }
        if (! sizeof($numbers)) {
            $numbers = array(0);
        }
        return $numbers;
    }
574984
public function all($namespace = null)
    {
        if (null === $namespace) {
            return $this->commands;
        }

        $commands = array();
        foreach ($this->commands as $name => $command) {
            if ($namespace === $this->extractNamespace($name, substr_count($namespace, ':') + 1)) {
                $commands[$name] = $command;
            }
        }

        return $commands;
    }
656162
protected function getVersionUrl(Version $version) : string
    {
        if (count($this->versionUrls) === 0) {
            $this->fetchSupportedVersions();
        }

        if (!array_key_exists($version->getAndroidVersion(), $this->versionUrls)) {
            throw new UnsupportedVersionException($version);
        }

        return $this->versionUrls[$version->getAndroidVersion()];
    }