Login   Register  
PHP Classes
elePHPant
Icontem

adding arguments to call

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us

      Simple Singleton and Multiton Class  >  All threads  >  adding arguments to call  >  (Un) Subscribe thread alerts  
Subject:adding arguments to call
Summary:This small revision will allow passing arguments ...
Messages:1
Author:Peter Drinnan
Date:2010-08-06 16:49:40
 

  1. adding arguments to call   Reply   Report abuse  
Picture of Peter Drinnan
Peter Drinnan
2010-08-06 16:49:41
<?php

class SimpleSingleton
{
/**
* Instance of this class
*/
private static $instance;

/**
* Always returns only one instance
*/
public static function GetInstance($params = NULL)
{

if ( ! is_null($params) AND ! is_array($params))
{
$params = NULL;
}


if (!isset(self::$instance))
{

if ($params !== NULL)
{

self::$instance = new self($params);

}
else
{
self::$instance = new self();

}


return self::$instance;
}

/**
* Private constructor
*/
private function __construct()
{

}
}

?>