Last active
September 27, 2017 08:20
-
-
Save richardsweeney/c12ce6675006df114852978790fdd0a0 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 | |
final class Singelton { | |
/** | |
* @var null|Singleton | |
*/ | |
protected static $instance = null; | |
/** | |
* Singleton constructor | |
*/ | |
private function __construct() { | |
// Yepp. | |
} | |
/** | |
* Get singleton instance | |
* | |
* @return Singleton | |
*/ | |
public static function get_instance() : Singleton { | |
if ( null === self::$instance ) { | |
self::$instance = new self; | |
} | |
return self::$instance; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment