Created
June 30, 2012 05:13
-
-
Save viniciusss/3022421 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
namespace Absolute; | |
class Auth{ | |
use Singleton; | |
} |
This file contains hidden or 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 | |
namespace Absolute; | |
trait Singleton{ | |
private static $_instance; | |
public static function getInstance() { | |
$className = __CLASS__; | |
if ( !self::$_instance instanceof $className ) | |
self::$_instance = new $className; | |
return self::$_instance; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment