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

class input
{
	public function __construct() {}

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

	public static function get(string $key, $default = null, $filter = 'cmd')
	{
		return self::input()->get($key, $default, $filter); // Joomla >= 1.7.1
	}

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

	public static function get_cmd(string $name)
	{
		return self::input()->getCmd($name);
	}

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

	public static function set(string $name, $value) // void
	{
		self::input()->set($name, $value);
	}

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

	public static function input()
	{
		static $val = null;
		if ($val === null)
		{
			$val = \com_eorisis_pixels\framework\lib\core\cms\application::get()->input;
		}

		return $val;
	}

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

	public static function current_option() : string
	{
		static $val = null;
		if ($val === null)
		{
			$val = (string)self::input()->get('option', '');
		}

		return $val;
	}

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

	public static function current_view() : string
	{
		static $val = null;
		if ($val === null)
		{
			$val = (string)self::input()->get('view', '');
		}

		return $val;
	}

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

	public static function on_edit() : bool
	{
		// Should not be static
		return self::input()->get('layout') == 'edit';
	}
}
