• Модуль: sale
  • Путь к файлу: ~/bitrix/modules/sale/lib/paysystem/manager.php
  • Класс: BitrixSalePaySystemManager
  • Вызов: Manager::getPathToHandlerFolder
static function getPathToHandlerFolder($folder): ?string
{
	if (!$folder)
	{
		return null;
	}

	$documentRoot = Application::getDocumentRoot();
	$dirs = self::getHandlerDirectories();

	if (mb_strpos($folder, DIRECTORY_SEPARATOR) !== false)
	{
		$folderWithoutHandlerName = array_slice(explode(DIRECTORY_SEPARATOR, $folder), 1, -1);
		$folderWithoutHandlerName = implode(DIRECTORY_SEPARATOR, $folderWithoutHandlerName);

		$handlersDirectory = new Directory($folderWithoutHandlerName);
		$handlersDirectoryPhysicalPath = DIRECTORY_SEPARATOR.$handlersDirectory->getPhysicalPath().DIRECTORY_SEPARATOR;

		foreach ($dirs as $dir)
		{
			if ($documentRoot.$dir !== $documentRoot.$handlersDirectoryPhysicalPath)
			{
				continue;
			}

			return Directory::isDirectoryExists($documentRoot.$folder) ? $folder : null;
		}
	}
	else
	{
		foreach ($dirs as $dir)
		{
			$path = $dir.$folder;
			if (!Directory::isDirectoryExists($documentRoot.$path))
			{
				continue;
			}

			return $path;
		}
	}

	return null;
}