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 ) {
123 return ObjectFactory::getObjectFromSpec(
$params + [
124 'args' => $this->params,
125 'closure_expansion' =>
false,
138 return $this->
_call( $name, $args );
147 public function _get( $name ) {
148 $this->
_unstub(
"__get($name)", 5 );
160 return $this->
_get( $name );
169 public function _set( $name, $value ) {
170 $this->
_unstub(
"__set($name)", 5 );
181 public function __set( $name, $value ) {
182 $this->
_set( $name, $value );
196 public function _unstub( $name =
'_unstub', $level = 2 ) {
197 static $recursionLevel = 0;
199 if ( !$GLOBALS[$this->global] instanceof
self ) {
203 if ( get_class( $GLOBALS[$this->global] ) != $this->
class ) {
205 if ( ++$recursionLevel > 2 ) {
206 throw new LogicException(
"Unstub loop detected on call of "
207 .
"\${$this->global}->$name from $caller\n" );
209 wfDebug(
"Unstubbing \${$this->global} on call of "
210 .
"\${$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...