$selected =
$this->
getNumberBySelection($productId,
$selection);
} if ($selected !== ''
) { return $selected;
} if ($this->
isNumberAvailable($number)) { return $number;
} if ($this->
hasNotificationsActive($productId)) { return $number;
} $selected =
$this->
findFallbackById($productId);
if ($selected === ''
) { throw new RuntimeException(sprintf('No active product variant found for product with number "%s" and id "%s"',
$number,
$productId));
} return $selected;
}