essential-addons-for-elementor-lite
/
vendor
/
priyomukul
/
wp-notice
/
src
/
Utils
Last commit date
Base.php
2 years ago
CacheBank.php
2 years ago
Helper.php
2 years ago
NoticeRemover.php
2 years ago
Storage.php
2 years ago
Base.php
45 lines
| 1 | <?php |
| 2 | |
| 3 | namespace PriyoMukul\WPNotice\Utils; |
| 4 | |
| 5 | #[\AllowDynamicProperties] |
| 6 | abstract class Base { |
| 7 | /** |
| 8 | * Holds the plugin instance. |
| 9 | * |
| 10 | * @since 2.0.0 |
| 11 | * @access protected |
| 12 | * @static |
| 13 | * |
| 14 | * @var Base |
| 15 | */ |
| 16 | private static $instances = []; |
| 17 | |
| 18 | /** |
| 19 | * Sets up a single instance of the plugin. |
| 20 | * |
| 21 | * @return static An instance of the class. |
| 22 | * @since 1.0.0 |
| 23 | * @access public |
| 24 | * @static |
| 25 | * |
| 26 | */ |
| 27 | public static function get_instance( ...$args ) { |
| 28 | $module = get_called_class(); |
| 29 | $module_id = $module; |
| 30 | |
| 31 | if ( $module === 'PriyoMukul\WPNotice\Notice' || $module === 'PriyoMukul\WPNotice\Dismiss' ) { |
| 32 | $module_id = $module . '::' . $args[0]; |
| 33 | } |
| 34 | |
| 35 | if ( ! isset( self::$instances[ $module_id ] ) ) { |
| 36 | self::$instances[ $module_id ] = new $module( ...$args ); |
| 37 | } |
| 38 | |
| 39 | return self::$instances[ $module_id ]; |
| 40 | } |
| 41 | |
| 42 | protected function database( $args = null ) { |
| 43 | return new Storage( $args ); |
| 44 | } |
| 45 | } |