Last active
December 11, 2015 12:28
-
-
Save mintindeed/4600768 to your computer and use it in GitHub Desktop.
For reference: http://scotty-t.com/2012/07/09/wp-you-oop/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
abstract class PMC_Base { | |
private static $_instance = array(); | |
private function __construct() {} | |
public static function get_instance() { | |
$class = get_called_class(); | |
if ( ! isset( self::$_instance[$class] ) ) { | |
self::$_instance[$class] = new $class(); | |
self::$_instance[$class]->_init(); | |
} | |
return self::$_instance[$class]; | |
} | |
abstract protected function _init(); | |
} | |
//EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment