src/Plugin/Monkey.php
public static function patch($source, $dest = null)
    {
        $source = ltrim($source, '\\');
        if (is_object($source) || class_exists($source)) {
            $reference = $source;
        } else {
            $reference = null;
            if (MonkeyPatcher::blacklisted($source)) {
                throw new Exception("Monkey patching `{$source}()` is not supported by Kahlan.");
            }
        }
        $method = static::$_registered[$source] = new Method(compact('reference'));
        if (!$dest) {
            return $method;
        }
        $method->toBe($dest);
        return $method;
    }
public static function patch($source, $dest = null)
    {
        $source = ltrim($source, '\\');
        if (is_object($source) || class_exists($source)) {
            $reference = $source;
        } else {
            $reference = null;
            if (MonkeyPatcher::blacklisted($source)) {
                throw new Exception("Monkey patching `{$source}()` is not supported by Kahlan.");
            }
        }
        $method = static::$_registered[$source] = new Method(compact('reference'));
        if (!$dest) {
            return $method;
        }
        $method->toBe($dest);
        return $method;
    }
public static function patch ( $ source , $ dest = null ) { $ source = ltrim ( $ source , '\\' ) ; if ( is_object ( $ source ) || class_exists ( $ source ) ) { $ reference = $ source ; } else { $ reference = null ; if ( MonkeyPatcher :: blacklisted ( $ source ) ) { throw new Exception ( "Monkey patching `{$source}()` is not supported by Kahlan." ) ; } } $ method = static :: $ _registered [ $ source ] = new Method ( compact ( 'reference' ) ) ; if ( ! $ dest ) { return $ method ; } $ method -> toBe ( $ dest ) ; return $ method ; }
Setup a monkey patch.

@param string $source A fully namespaced reference string.
@param string $dest   A fully namespaced reference string.
Setup a monkey patch .