Skip to content

Instantly share code, notes, and snippets.

@tannerm
Created April 21, 2014 18:18
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 tannerm/11151380 to your computer and use it in GitHub Desktop.
Save tannerm/11151380 to your computer and use it in GitHub Desktop.
<?php
Singleton::get_instance();
class Singleton {
/**
* @var
*/
protected static $_instance;
/**
* Only make one instance of the Singleton
*
* @return Singleton
*/
public static function get_instance() {
if ( ! self::$_instance instanceof Singleton ) {
self::$_instance = new self();
}
return self::$_instance;
}
/**
* Add Hooks and Actions
*/
protected function __construct() { }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment