30use Wikimedia\ObjectFactory\ObjectFactory;
78 if ( is_callable(
$class ) ) {
94 return is_object( $obj ) && !$obj instanceof
self;
106 if ( $obj instanceof
self ) {
107 $obj = $obj->_unstub(
'unstub', 3 );
123 public function _call( $name, $args ) {
125 return call_user_func_array( [ $GLOBALS[$this->global], $name ], $args );
140 return ObjectFactory::getObjectFromSpec(
$params + [
141 'args' => $this->params,
142 'closure_expansion' =>
false,
155 return $this->
_call( $name, $args );
165 public function _get( $name ) {
166 $this->
_unstub(
"__get($name)", 5 );
178 return $this->
_get( $name );
188 public function _set( $name, $value ) {
189 $this->
_unstub(
"__set($name)", 5 );
200 public function __set( $name, $value ) {
201 $this->
_set( $name, $value );
216 public function _unstub( $name =
'_unstub', $level = 2 ) {
217 static $recursionLevel = 0;
219 if ( !$GLOBALS[$this->global] instanceof
self ) {
223 if ( get_class( $GLOBALS[$this->global] ) != $this->
class ) {
225 if ( ++$recursionLevel > 2 ) {
226 throw new LogicException(
"Unstub loop detected on call of "
227 .
"\${$this->global}->$name from $caller\n" );
229 wfDebug(
"Unstubbing \${$this->global} on call of "
230 .
"\${$this->global}::$name from $caller" );
239class_alias( StubObject::class,
'StubObject' );
wfDebug( $text, $dest='all', array $context=[])
Sends a line to the debug log if enabled or, optionally, to a comment in output.
wfGetCaller( $level=2)
Get the name of the function which called this function wfGetCaller( 1 ) is the function with the wfG...