17use Wikimedia\ObjectFactory\ObjectFactory;
65 if ( is_callable(
$class ) ) {
81 return is_object( $obj ) && !$obj instanceof
self;
92 public static function unstub( &$obj ) {
93 if ( $obj instanceof
self ) {
94 $obj = $obj->_unstub(
'unstub', 3 );
109 public function _call( $name, $args ) {
125 return ObjectFactory::getObjectFromSpec(
$params + [
126 'args' => $this->params,
127 'closure_expansion' =>
false,
140 return $this->
_call( $name, $args );
149 public function _get( $name ) {
150 $this->
_unstub(
"__get($name)", 5 );
162 return $this->
_get( $name );
171 public function _set( $name, $value ) {
172 $this->
_unstub(
"__set($name)", 5 );
183 public function __set( $name, $value ) {
184 $this->
_set( $name, $value );
198 public function _unstub( $name =
'_unstub', $level = 2 ) {
199 static $recursionLevel = 0;
201 if ( !$GLOBALS[$this->global] instanceof
self ) {
205 if ( get_class( $GLOBALS[$this->global] ) != $this->
class ) {
207 if ( ++$recursionLevel > 2 ) {
208 throw new LogicException(
"Unstub loop detected on call of "
209 .
"\${$this->global}->$name from $caller\n" );
211 wfDebug(
"Unstubbing \${$this->global} on call of "
212 .
"\${$this->global}::$name from $caller" );
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...