Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on May 24th, 2013  |  syntax: PHP  |  size: 0.56 KB  |  views: 24  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <?php
  2.  
  3.         namespace net\snapserv;
  4.  
  5.         trait Singleton {
  6.                 /**
  7.                  * @var self
  8.                  */
  9.                 private static $instance;
  10.  
  11.                 /**
  12.                  * @return self
  13.                  */
  14.                 public static function getInstance() {
  15.                         if(!self::$instance)
  16.                                 self::$instance = new self;
  17.                         return self::$instance;
  18.                 }
  19.  
  20.                 private function __construct() {}
  21.         }
  22.  
  23.         ?>