<?php
namespace PremiumAddonsPro\Base;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
abstract class Module_Base {
/**
* @var \ReflectionClass
*/
private $reflection;
/**
* @var Module_Base
*/
protected static $_instances = array();
public static function is_active() {
return true;
}
public static function class_name() {
return get_called_class();
}
/**
* @return static
*/
public static function instance() {
if ( empty( static::$_instances[ static::class_name() ] ) ) {
static::$_instances[ static::class_name() ] = new static();
}
return static::$_instances[ static::class_name() ];
}
public function __construct() {
$this->reflection = new \ReflectionClass( $this );
}
}