Created
April 21, 2014 18:18
-
-
Save tannerm/11151380 to your computer and use it in GitHub Desktop.
This file contains 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 | |
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