<?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\lib\core\cms;
\defined('_JEXEC') or die;

use EorisisFactory, JLoader;

if (!\class_exists('EorisisFactory', false))
{
	if (\version_compare(JVERSION, '3.8', '>='))
	{
		JLoader::registerAlias('EorisisFactory', '\\Joomla\\CMS\\Factory');
	}
	else
	{
		JLoader::registerAlias('EorisisFactory', 'JFactory');
	}
}

class user
{
	public function __construct() {}

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

	public static function obj($id = null)
	{
		return EorisisFactory::getUser($id);
	}

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

	public static function id() : int
	{
		static $id = 0;
		if ($id)
		{
			return $id;
		}

		$id = (int)self::obj()->get('id');
		return $id;
	}

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

	public static function is_logged() : bool
	{
		return self::id() > 0;
	}
}
