Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save patricknelson/162930fdbe56f95b0d8f2d7d77abdf82 to your computer and use it in GitHub Desktop.
Save patricknelson/162930fdbe56f95b0d8f2d7d77abdf82 to your computer and use it in GitHub Desktop.
<?php
class Injector extends Nestception {
// ... rest of class...
public static function unnestTemp($callable) {
// Retain current instance so we can revert back to it momentarily.
$revertTo = self::inst();
// Unnest.
self::unnest();
// Execute.
call_user_func($callable, $revertTo);
// Revert!
return self::set_inst($revertTo);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment