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

use com_eorisis_pixels\framework\lib\core\app\config as app_config;

class valid
{
	public function __construct() {}

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

	public static function view($string) : string
	{
		if (\in_array($string, app_config::LIST_VIEWS) or
			\in_array($string, app_config::EDIT_VIEWS))
		{
			return $string;
		}

		return app_config::DEFAULT_VIEW;
	}

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

	public static function list_view($string) : string
	{
		return \in_array($string, app_config::LIST_VIEWS) ? $string : app_config::DEFAULT_VIEW;
	}

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

	public static function edit_view($string) : string
	{
		return \in_array($string, app_config::EDIT_VIEWS) ? $string : app_config::DEFAULT_VIEW;
	}

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

	public static function scheme($val, string $default) : string
	{
		return \in_array($val, ['http','https']) ? $val : $default;
	}
}
