How does \Magento\Catalog\Model\ResourceModel\Product\Option\Collection::addValuesToResult() work?

Context: How does \Magento\Catalog\Model\ResourceModel\Product\Option\Collection::getProductOptions() work?

if ($storeId === null) {
	$storeId = $this->_storeManager->getStore()->getId();
}
$optionIds = [];
foreach ($this as $option) {
	$optionIds[] = $option->getId();
}
if (!empty($optionIds)) {
	/** @var \Magento\Catalog\Model\ResourceModel\Product\Option\Value\Collection $values */
	$values = $this->_optionValueCollectionFactory->create();
	$values->addTitleToResult(
		$storeId
	)->addPriceToResult(
		$storeId
	)->addOptionToFilter(
		$optionIds
	)->setOrder(
		'sort_order',
		self::SORT_ORDER_ASC
	)->setOrder(
		'title',
		self::SORT_ORDER_ASC
	);

	foreach ($values as $value) {
		$optionId = $value->getOptionId();
		if ($this->getItemById($optionId)) {
			$this->getItemById($optionId)->addValue($value);
			$value->setOption($this->getItemById($optionId));
		}
	}
}

return $this;