golden hour
/home/phakp/public_html/wp-content/plugins/whp-hide-posts/inc/traits
⬆️ Go Up
Upload
File/Folder
Size
Actions
trait-singleton.php
596 B
Del
OK
Edit: trait-singleton.php
<?php /** * Signleton trait * * @package WordPressHidePosts */ namespace MartinCV\WHP\Traits; trait Singleton { /** * Instance of the object * * @var \Object */ private static $instance = null; /** * Setup singleton instance * * @return \Object */ public static function get_instance() { if ( is_null( self::$instance ) ) { self::$instance = new static(); } return self::$instance; } /** * Private consturct * * @return void */ private function __construct() { if ( method_exists( $this, 'initialize' ) ) { $this->initialize(); } } }
Save