mirror of
https://github.com/inretio/WordPress-Plugin-Boilerplate
synced 2024-12-22 20:03: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:
parent
8afcf2547f
commit
0d8277d858
1 changed files with 8 additions and 1 deletions
|
@ -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;
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue