<?php
/*
 * Software Name: Eorisis Pixels
 * Software URI: https://eorisis.com/shop/software/joomla/pixels
 * Author: Eorisis
 * Author URI: https://eorisis.com
 * Copyright: Copyright (C) 2011-2025 EORISIS. All Rights Reserved.
 * License: GNU General Public License version 2; See https://eorisis.com/gpl
 * Terms of Service: https://eorisis.com/tos
 */
namespace com_eorisis_pixels\framework\install_package\lib\core\model;
\defined('_JEXEC') or die;

use version_compare, str_replace;
use com_eorisis_pixels\framework\install_package\lib\core\model\setup;
use com_eorisis_pixels\framework\install_package\lib\core\model\data;

class updates
{
	public function __construct() {}

	// --------------------------------------------------

	public function process(array $updates) // void
	{
		if (!data::$ext_version_old || setup::$setup_type != 'update')
		{
			return;
		}

		foreach ($updates as $version)
		{
			if (version_compare(data::$ext_version_old, $version, '>='))
			{
				continue;
			}

			$class = '\\com_eorisis_pixels\\framework\\install_package\\lib\\core\\update\\v'.str_replace('.', '_', $version);
			$update = new $class;
			$update->execute($version);
		}
	}
}
