Inherited by StubContLang, StubUser, and StubUserLang.
Public Member Functions | |
__construct ($global=null, $class=null, $params=array()) | |
Constructor. | |
_call ($name, $args) | |
Function called if any function exists with that name in this object. | |
_newObject () | |
Create a new object to replace this stub object. | |
__call ($name, $args) | |
Function called by PHP if no function with that name exists in this object. | |
_unstub ($name= '_unstub', $level=2) | |
This function creates a new object of the real class and replace it in the global variable. | |
Static Public Member Functions | |
static | isRealObject ($obj) |
Returns a bool value whetever $obj is a stub object. | |
Public Attributes | |
$mGlobal | |
$mClass | |
$mParams |
Note on unstub loops:
Unstub loops (infinite recursion) sometimes occur when a constructor calls another function, and the other function calls some method of the stub. The best way to avoid this is to make constructors as lightweight as possible, deferring any initialisation which depends on other modules. As a last resort, you can use StubObject::isRealObject() to break the loop, but as a general rule, the stub object mechanism should be transparent, and code which refers to it should be kept to a minimum.
Definition at line 18 of file StubObject.php.
StubObject::__construct | ( | $ | global = null , |
|
$ | class = null , |
|||
$ | params = array() | |||
) |
Constructor.
String | $global name of the global variable. | |
String | $class name of the class of the real object. | |
Array | $param array of parameters to pass to contructor of the real object. |
Definition at line 29 of file StubObject.php.
StubObject::__call | ( | $ | name, | |
$ | args | |||
) |
Function called by PHP if no function with that name exists in this object.
String | $name name of the function called | |
Array | $args array of arguments |
Reimplemented in StubContLang, StubUserLang, and StubUser.
Definition at line 75 of file StubObject.php.
StubObject::_call | ( | $ | name, | |
$ | args | |||
) |
Function called if any function exists with that name in this object.
It is used to unstub the object. Only used internally, PHP will call self::__call() function and that function will call this function. This function will also call the function with the same name in the real object.
String | $name name of the function called. | |
Array | $args array of arguments. |
Definition at line 56 of file StubObject.php.
References $args, $GLOBALS, $name, and _unstub().
Referenced by StubUser::__call(), StubUserLang::__call(), StubContLang::__call(), and __call().
StubObject::_newObject | ( | ) |
Create a new object to replace this stub object.
Reimplemented in StubContLang, StubUserLang, and StubUser.
Definition at line 64 of file StubObject.php.
References wfCreateObject().
Referenced by _unstub().
StubObject::_unstub | ( | $ | name = '_unstub' , |
|
$ | level = 2 | |||
) |
This function creates a new object of the real class and replace it in the global variable.
This is public, for the convenience of external callers wishing to access properties, e.g. eval.php
String | $name name of the method called in this object. | |
Integer | $level level to go in the stact trace to get the function who called this function. |
Definition at line 89 of file StubObject.php.
References $fname, $GLOBALS, _newObject(), wfDebug(), wfGetCaller(), wfProfileIn(), and wfProfileOut().
Referenced by _call().
static StubObject::isRealObject | ( | $ | obj | ) | [static] |
Returns a bool value whetever $obj is a stub object.
Can be used to break a infinite loop when unstubbing an object.
Object | $obj object to check. |
Definition at line 42 of file StubObject.php.
References $obj.
Referenced by RawPage::getRawText(), Title::getUserPermissionsErrors(), wfDebug(), and wfLogProfilingData().
StubObject::$mClass |
Definition at line 19 of file StubObject.php.
StubObject::$mGlobal |
Definition at line 19 of file StubObject.php.
StubObject::$mParams |
Definition at line 19 of file StubObject.php.