patched() public static method

Patches the string.
public static patched ( string $namespace, string $ref, boolean $isFunc = true, &$substitute = null ) : string
$namespace string The namespace.
$ref string The fully namespaced class/function reference string.
$isFunc boolean Boolean indicating if $ref is a function reference.
return string A fully namespaced reference.
Beispiel #1
0
 public function subChild()
 {
     $__KMONKEY__18 = \kahlan\plugin\Monkey::patched(__NAMESPACE__, 'RecursiveIteratorIterator', false);
     if ($options['recursive']) {
         $worker = new $__KMONKEY__18($worker, $iteratorFlags);
     }
 }
Beispiel #2
0
 protected function dump()
 {
     $__KMONKEY__0 = \Kahlan\Plugin\Monkey::patched(null, 'Kahlan\\Util\\Text');
     return $__KMONKEY__0::dump('Hello');
 }
Beispiel #3
0
<?php

$__KMONKEY__3 = \kahlan\plugin\Monkey::patched(null, 'name\\space\\MyClass2');
$__KMONKEY__2 = \kahlan\plugin\Monkey::patched(null, 'name\\space\\MyClass');
$__KMONKEY__1 = \kahlan\plugin\Monkey::patched(__NAMESPACE__, 'mt_rand', true);
$__KMONKEY__0 = \kahlan\plugin\Monkey::patched(__NAMESPACE__, 'function_exists', true);
use name\space\MyClass as MyAlias;
use name\space;
if ($__KMONKEY__0('myfunction')) {
    $thatIsWeird = true;
}
$rand = $__KMONKEY__1();
new $__KMONKEY__2();
new $__KMONKEY__3();
Beispiel #4
0
 /**
  * Return the actual reference which must be used.
  *
  * @param mixed $reference An instance or a fully-namespaced class name.
  * @param mixed            The reference or the monkey patched one if exist.
  */
 protected function _reference($reference)
 {
     if (!is_string($reference)) {
         return $reference;
     }
     $pos = strrpos($reference, '\\');
     if ($pos !== false) {
         $namespace = substr($reference, 0, $pos);
         $basename = substr($reference, $pos + 1);
     } else {
         $namespace = null;
         $basename = $reference;
     }
     $substitute = null;
     $reference = Monkey::patched($namespace, $basename, false, $substitute);
     return $substitute ?: $reference;
 }
Beispiel #5
0
<?php

$__KMONKEY__0 = \Kahlan\Plugin\Monkey::patched(__NAMESPACE__, 'function_exists');
$__KMONKEY__1 = \Kahlan\Plugin\Monkey::patched(__NAMESPACE__, 'mt_rand');
$__KMONKEY__2__ = null;
$__KMONKEY__2 = \Kahlan\Plugin\Monkey::patched(null, 'name\\space\\MyClass', false, $__KMONKEY__2__);
$__KMONKEY__3 = \Kahlan\Plugin\Monkey::patched(__NAMESPACE__, 'time');
$__KMONKEY__4__ = null;
$__KMONKEY__4 = \Kahlan\Plugin\Monkey::patched(null, 'name\\space\\MyClass2', false, $__KMONKEY__4__);
use name\space\MyClass as MyAlias;
use name\space;
if ($__KMONKEY__0('myfunction')) {
    $thatIsWeird = true;
}
$rand = $__KMONKEY__1();
$__KMONKEY__2__ ? $__KMONKEY__2__ : new $__KMONKEY__2();
$__KMONKEY__4__ ? $__KMONKEY__4__ : new $__KMONKEY__4($__KMONKEY__3());
Beispiel #6
0
 public function subChild()
 {
     $__KMONKEY__20__ = null;
     $__KMONKEY__20 = \Kahlan\Plugin\Monkey::patched(__NAMESPACE__, 'RecursiveIteratorIterator', false, $__KMONKEY__20__);
     if ($options['recursive']) {
         $worker = $__KMONKEY__20__ ? $__KMONKEY__20__ : new $__KMONKEY__20($worker, $iteratorFlags);
     }
 }