<?php

/********************************************************************
 * Copyright (C) 2025 Hassine RIANI (https://upvimeo.com)
 *
 * This file is part of Upvimeo
 *
 * Upvimeo is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 2 of the License, or
 * (at your option) any later version.
 *
 * Upvimeo is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Upvimeo. If not, see <https://www.gnu.org/licenses/>.
 **********************************************************************/

/**
 * Trait UpVimeo_Singleton
 */
trait UpVimeo_Singleton
{
	/**
	 * The singleton instance
	 * @var static
	 */
	private static $instance = null;
	protected function __construct() {}
	private function __clone() {}

	/**
	 * The singleton instance
	 * @return null|static
	 */
	public static function instance()
	{
		if (static::$instance === null) {
			static::$instance = new static();
		}
		return static::$instance;
	}
}
