Your IP : 216.73.216.86


Current Path : /var/www/homesaver/www/bitrix/updates/update_m1740076642/main/lib/cli/helper/
Upload File :
Current File : /var/www/homesaver/www/bitrix/updates/update_m1740076642/main/lib/cli/helper/namespacegenerator.php

<?php

namespace Bitrix\Main\Cli\Helper;

final class NamespaceGenerator
{
	public function generateNamespaceForModule(string $moduleId, string $postfix = null): string
	{
		$partnerModuleSeparator = '.';
		$parts = explode($partnerModuleSeparator, $moduleId);

		$isBitrixModule = count($parts) === 1;
		if ($isBitrixModule)
		{
			array_unshift($parts, 'bitrix');
		}

		$parts = array_map(
			static fn ($part) => ucfirst($part),
			$parts
		);

		$namespace = join('\\', $parts);
		if (!empty($postfix))
		{
			$namespace .= '\\' . trim($postfix, '\\');
		}

		return $namespace;
	}
}