Пример #1
0
 /**
  * Get instance of the singleton
  *
  * @return PStub_RunkitAdapter
  */
 public static function getInstance()
 {
     if (null == self::$instance) {
         self::$instance = new self();
     }
     return self::$instance;
 }
Пример #2
0
 /**
  * Suppress constructor in class
  *
  * @param string $classname
  * @throws PStub_Suppressor_Exception
  */
 private function suppressConstructorInClass($classname)
 {
     $runkit = PStub_RunkitAdapter::getInstance();
     try {
         $runkit->redefineConstructor($classname, '', '');
     } catch (PStub_RunkitAdapter_Exception $e) {
         throw new PStub_Suppressor_Exception('Constructor suppression failed: ' . $e->getMessage());
     }
 }
Пример #3
0
 /**
  * Revert body to original
  *
  */
 public function revertBody()
 {
     // if was not redefined, nothing to do
     if (!isset(self::$redefinedFunctionsBodies[$this->name])) {
         return;
     }
     $runkit = PStub_RunkitAdapter::getInstance();
     try {
         $runkit->revertRedefinedFunction($this->name);
     } catch (PStub_RunkitAdapter_Exception $e) {
         // weird, but nothing criminal
     }
     unset(self::$redefinedFunctionsBodies[$this->name]);
 }
Пример #4
0
 /**
  * Revert body to original
  *
  */
 public function revertBody()
 {
     $classname = $this->getDeclaringClass()->getName();
     // if was not redefined, nothing to do
     if (!isset(self::$redefinedMethodsBodies[$classname][$this->name])) {
         return;
     }
     $runkit = PStub_RunkitAdapter::getInstance();
     try {
         $runkit->revertRedefinedMethod($classname, $this->name);
     } catch (PStub_RunkitAdapter_Exception $e) {
         // weird, but nothing criminal
     }
     unset(self::$redefinedMethodsBodies[$classname][$this->name]);
 }