Skip to content

Instantly share code, notes, and snippets.

@viniciusss
Created June 30, 2012 05:13
Show Gist options
  • Save viniciusss/3022421 to your computer and use it in GitHub Desktop.
Save viniciusss/3022421 to your computer and use it in GitHub Desktop.
<?php
namespace Absolute;
class Auth{
use Singleton;
}
<?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