<?php
/***************************************************************************
 *                                                                          *
 * Copyright (c) 2005 ISPG Technologies (I) Pvt Ltd. All rights reserved.   *
 *                                                                          *
 * This  is  commercial  software,  only  users  who have purchased a valid *
 * license  and  accept  to the terms of the  License Agreement can install *
 * and use this program.                                                    *
 *                                                                          *
 ****************************************************************************
 * PLEASE READ THE FULL TEXT  OF THE SOFTWARE  LICENSE   AGREEMENT  IN  THE *
 * "copyright.txt" FILE PROVIDED WITH THIS DISTRIBUTION PACKAGE.            *
 ****************************************************************************/
//
//$Id: registry.engine.php,v 1.0 2011/06/14 20:52:11
//Registry - Registry Engine for Oorjit Deal System
//
class Registry {
    public static $_instance;
    //Constructor for Registry class
    public function __construct() {
        self::$_instance = array();
    }
    //To set instance
    public static function setInstance($entryKey, $entryValue = '') {
        if ($entryValue == "") {
            return self::$_instance[$entryKey] = new $entryKey();
        } else {
            return self::$_instance[$entryKey] = $entryValue;
        }
    }
    //To get instance
    public static function getInstance($entryKey, $entryValue = '') {
        if (self::isInstance($entryKey)) {
            return self::$_instance[$entryKey];
        } else {
            return self::setInstance($entryKey, $entryValue);
        }
    }
    //To check is instance
    public static function isInstance($entryKey) {
        return (@self::$_instance[$entryKey]) == "" ? false : true;
    }
}
