| Server IP : 121.121.20.254 / Your IP : 216.73.216.145 Web Server : Microsoft-IIS/10.0 System : Windows NT WEB-SERVER 10.0 build 20348 (Windows Server 2022) AMD64 User : IUSR ( 0) PHP Version : 8.3.28 Disable Function : NONE MySQL : ON | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/inetpub/wwwroot/KnowledgeBase/wp-content/plugins/wpmu-dev-seo/includes/core/ |
Upload File : |
<?php
/**
* Trait Singletone
*
* @package Smartcrawl
* @subpackage Trait
*/
namespace SmartCrawl;
if ( ! defined( 'WPINC' ) ) {
die;
}
trait Singleton {
/**
* Instance holder.
*
* @var static $instance
*/
private static $instance;
/**
* Instance obtaining or resetting method.
*
* @since 3.1.0
*
* @param bool $reset To reset the instance instead.
*
* @return static Called class instance.
*/
public static function get( $reset = false ) {
// Just reset the instance.
if ( $reset ) {
self::$instance = null;
return null;
}
$called_class_name = get_called_class();
// Only if not already exist.
if ( ! self::$instance instanceof $called_class_name ) {
self::$instance = new $called_class_name();
}
return self::$instance;
}
}