<?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 SimpleXMLElement;

class xml
{
	public function __construct() {}

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

	public static function element(string $contents)
	{
		if ($contents)
		{
			return new SimpleXMLElement($contents);
		}
	}

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

	public static function element_from_file(string $path, bool $check = true)
	{
		if ($check)
		{
			$contents = \com_eorisis_pixels\framework\install_package\lib\core\model\filesystem::read_file($path);
		}
		else
		{
			$contents = \file_get_contents($path);
		}

		return self::element($contents);
	}
}
