Documentation

getCode

public static function
\Bitrix\Sale\Services\Base\Restriction::getCode();

Method returns type of limit/restriction. Static method.

For limiting Bitrix\* namespace, returns class name without namespaces as a type. Full class name with namespace will be returned as user's custom restriction. Examples::

  • for currency limit class Bitrix\Currency, returns currency;
  • for user currency limit class Vendor\Currency returns Vendor\Currency.

Parameters

No parameters.

Examples

 
public static function getCode(): string
{
	$class = new \ReflectionClass(static::class);
	if (self::isBitrixNamespace($class->getNamespaceName()))
		{
		return $class->getShortName();
		}

	return $class->getName();
}


© «Bitrix24», 2001-2024
Up