mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-06 10:11:38 +09:00
git-svn-id: http://xe-core.googlecode.com/svn/trunk@7470 201d5d3c-b55e-5fd7-737f-ddc643e51545
33 lines
No EOL
1.1 KiB
PHP
33 lines
No EOL
1.1 KiB
PHP
<?php
|
|
/**
|
|
* This is only meant for PHP 5 to get rid of certain strict warning
|
|
* that doesn't get hidden since it's in the shutdown function
|
|
*/
|
|
class PEAR5
|
|
{
|
|
/**
|
|
* If you have a class that's mostly/entirely static, and you need static
|
|
* properties, you can use this method to simulate them. Eg. in your method(s)
|
|
* do this: $myVar = &PEAR5::getStaticProperty('myclass', 'myVar');
|
|
* You MUST use a reference, or they will not persist!
|
|
*
|
|
* @access public
|
|
* @param string $class The calling classname, to prevent clashes
|
|
* @param string $var The variable to retrieve.
|
|
* @return mixed A reference to the variable. If not set it will be
|
|
* auto initialised to NULL.
|
|
*/
|
|
static function &getStaticProperty($class, $var)
|
|
{
|
|
static $properties;
|
|
if (!isset($properties[$class])) {
|
|
$properties[$class] = array();
|
|
}
|
|
|
|
if (!array_key_exists($var, $properties[$class])) {
|
|
$properties[$class][$var] = null;
|
|
}
|
|
|
|
return $properties[$class][$var];
|
|
}
|
|
} |