Revision 5146,
1.1 KB
checked in by wmerlotto, 13 years ago
(diff) |
Ticket #2305 - Enviando alteracoes, desenvolvidas internamente na Prognus. Library: adicionando arquivos.
|
Line | |
---|
1 | <?php |
---|
2 | /** |
---|
3 | * This is only meant for PHP 5 to get rid of certain strict warning |
---|
4 | * that doesn't get hidden since it's in the shutdown function |
---|
5 | */ |
---|
6 | class PEAR5 |
---|
7 | { |
---|
8 | /** |
---|
9 | * If you have a class that's mostly/entirely static, and you need static |
---|
10 | * properties, you can use this method to simulate them. Eg. in your method(s) |
---|
11 | * do this: $myVar = &PEAR5::getStaticProperty('myclass', 'myVar'); |
---|
12 | * You MUST use a reference, or they will not persist! |
---|
13 | * |
---|
14 | * @access public |
---|
15 | * @param string $class The calling classname, to prevent clashes |
---|
16 | * @param string $var The variable to retrieve. |
---|
17 | * @return mixed A reference to the variable. If not set it will be |
---|
18 | * auto initialised to NULL. |
---|
19 | */ |
---|
20 | static function &getStaticProperty($class, $var) |
---|
21 | { |
---|
22 | static $properties; |
---|
23 | if (!isset($properties[$class])) { |
---|
24 | $properties[$class] = array(); |
---|
25 | } |
---|
26 | |
---|
27 | if (!array_key_exists($var, $properties[$class])) { |
---|
28 | $properties[$class][$var] = null; |
---|
29 | } |
---|
30 | |
---|
31 | return $properties[$class][$var]; |
---|
32 | } |
---|
33 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.