1
0
Fork 0
mirror of https://github.com/inretio/WordPress-Plugin-Boilerplate synced 2024-12-22 11:53:53 +02:00

refactoring the ternary operator in the constructor to make the code more readable and to remove the potential for an orphaned object

fixes #39
This commit is contained in:
Tom McFarlin 2013-05-09 21:19:16 -04:00
parent 8afcf2547f
commit 0d8277d858

View file

@ -59,7 +59,14 @@ class PluginName {
* @return PluginName A single instance of this class.
*/
public function get_instance() {
return null == self::$instance ? new self : self::$instance;
// If the single instance hasn't been set, set it now.
if( null == self::$instance ) {
self::$instance = new self;
} // end if
return self::$instance;
} // end get_instance;
/**