private function determineIdentifierType($identifier, $identifierType)
{
$allowedTypes = [self::TYPE_ID, self::TYPE_NAME];
if (!is_null($identifierType) && in_array($identifierType, $allowedTypes)) {
return $identifierType;
} elseif (!is_null($identifierType)) {
throw new InvalidArgumentException(sprintf('Invalid identifier type %s', $identifierType));
}
if (is_numeric($identifier)) {
return self::TYPE_ID;
}
return self::TYPE_NAME;
}