AnonSec Team
Server IP : 127.0.0.1  /  Your IP : 127.0.0.1
Web Server : Apache/2.4.10 (Win32) OpenSSL/1.0.1i PHP/5.6.3
System : Windows NT WIN-R7LTCC7BPLI 6.3 build 9200 (Windows Server 2012 R2 Datacenter Edition) i586
User : GerbangSIPAD ( 0)
PHP Version : 5.6.3
Disable Function : NONE
MySQL : ON  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF
Directory (0777) :  C:/xampp5/php/pear/Math/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : C:/xampp5/php/pear/Math/Finance_FunctionParameters.php
<?php
/**
 * Singleton class to preserve given values of other variables in the callback functions
 */
class Math_Finance_FunctionParameters
{
    var $parameters = array();

    /**
    * Constructor. Should be private, so used little hack.
    *
    * @param bool       Whether constructor has been called from a method of the class
    * @param array      Parameters (variables values of the function) to be preserved
    * @access private
    */
    function Math_Finance_FunctionParameters($called_from_get_instance = False, $parameters = array())
    {
		// PHP4 hack
		if (!$called_from_get_instance)
			trigger_error("Cannot instantiate Math_Finance_FunctionParameters class directly (It's a Singleton)", E_USER_ERROR);
        
        foreach ($parameters as $name => $value) {
            $this->parameters[$name] = $value;
        }
    }

    /**
    * Method to be called statically to create Singleton
    *
    * @param array      Parameters (variables values of the function) to be preserved
    * @param bool       Whether the Singleton should be reset
    * @static
    * @access public
    */
	function &getInstance($parameters = array(), $reset = False)
	{
		static $singleton;

        if ($reset) $singleton = null;

		if (!is_object($singleton)) {
			$singleton = new Math_Finance_FunctionParameters(True, $parameters);
		}

		return $singleton;
	}
}
?>

AnonSec - 2021