• Модуль: tasks
  • Путь к файлу: ~/bitrix/modules/tasks/lib/util/assert.php
  • Класс: BitrixTasksUtilAssert
  • Вызов: Assert::expectEnumerationMember
static function expectEnumerationMember($arg, $enum = [], $argName = '', $customMsg = '')
{
	if (!mb_strlen($arg))
	{
		throw new MainArgumentException(Loc::getMessage('TASKS_ASSERT_EMPTY_ARGUMENT'));
	}

	if (!is_array($enum) || empty($enum))
	{
		throw new MainArgumentException(Loc::getMessage('TASKS_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('TASKS_ASSERT_ITEM_NOT_IN_ENUMERATION', $argName, $customMsg)
	);
}