You are here

function PEAR::getStaticProperty in Flickr API 5

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 = &PEAR::getStaticProperty('myclass', 'myVar'); You MUST use a reference, or they will not persist!

@access public

Parameters

string $class The calling classname, to prevent clashes:

string $var The variable to retrieve.:

Return value

mixed A reference to the variable. If not set it will be auto initialised to NULL.

3 calls to PEAR::getStaticProperty()
HTTP_Request::sendRequest in phpFlickr/PEAR/HTTP/Request.php
Sends the request
PEAR_Error::PEAR_Error in phpFlickr/PEAR/PEAR.php
PEAR_Error constructor
_PEAR_call_destructors in phpFlickr/PEAR/PEAR.php

File

phpFlickr/PEAR/PEAR.php, line 229

Class

PEAR
Base class for other PEAR classes. Provides rudimentary emulation of destructors.

Code

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];
}