1<?php 2class Singleton 3{ 4 private static $uniqueInstance = null; 5 6 protected function __construct() 7 { 8 } 9 10 final private function __clone() 11 { 12 } 13 14 public static function getInstance() 15 { 16 if (self::$uniqueInstance === null) { 17 self::$uniqueInstance = new self; 18 } 19 20 return self::$uniqueInstance; 21 } 22} 23