Skip to content

Instantly share code, notes, and snippets.

@mintindeed
Last active December 11, 2015 12:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mintindeed/4600768 to your computer and use it in GitHub Desktop.
Save mintindeed/4600768 to your computer and use it in GitHub Desktop.
<?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