• Модуль: sale
  • Путь к файлу: ~/bitrix/modules/sale/lib/location/util/assert.php
  • Класс: BitrixSaleLocationUtilAssert
  • Вызов: Assert::expectEnumerationMember
static function expectEnumerationMember($arg, $enum = array(), $argName = '', $customMsg = '')
{
	if($arg == '')
		throw new MainArgumentException(Loc::getMessage('SALE_LOCATION_ASSERT_EMPTY_ARGUMENT'));

	if(!is_array($enum) || empty($enum))
		throw new MainArgumentException(Loc::getMessage('SALE_LOCATION_ASSERT_EMPTY_ENUMERATION'));

	// we cannot use in_array() here, kz we need for real data type
	foreach($enum as $variant)
	{
		if($variant == $arg)
			return $variant;
	}

	throw new MainArgumentException(self::formMessage('SALE_LOCATION_ASSERT_ITEM_NOT_IN_ENUMERATION', $argName, $customMsg));
}