當前位置: 首頁>>代碼示例>>PHP>>正文


PHP runkit_function_rename函數代碼示例

本文整理匯總了PHP中runkit_function_rename函數的典型用法代碼示例。如果您正苦於以下問題:PHP runkit_function_rename函數的具體用法?PHP runkit_function_rename怎麽用?PHP runkit_function_rename使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了runkit_function_rename函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: plugin_wix_init

function plugin_wix_init()
{
    define('PatternFile', dirname(__FILE__) . '/WixPattern.txt');
    require_once $_SERVER['DOCUMENT_ROOT'] . '/wix_cms_newbody.php';
    runkit_function_rename('catbody', 'old_catbody');
    runkit_function_rename('new_catbody', 'catbody');
}
開發者ID:Tom39,項目名稱:pukiwiki,代碼行數:7,代碼來源:wix.inc.php

示例2: teardown

 function teardown()
 {
     runkit_function_rename('unslash', 'html_hilight_test_unslash');
     if (function_exists('html_hilight_test_unslash_real')) {
         runkit_function_rename('html_hilight_test_unslash_real', 'unslash');
     }
 }
開發者ID:stretchyboy,項目名稱:dokuwiki,代碼行數:7,代碼來源:html_hilight.test.php

示例3: getMock

 public function getMock()
 {
     $mock = $this->testCase->getMock('stdClass', $this->functions, array(), 'PHPUnit_Extension_FunctionMocker_' . uniqid());
     foreach ($this->functions as $function) {
         $fqFunction = $this->namespace . '\\' . $function;
         if (in_array($fqFunction, static::$mockedFunctions, true)) {
             continue;
         }
         if (!extension_loaded('runkit') || !ini_get('runkit.internal_override')) {
             PHPUnit_Extension_FunctionMocker_CodeGenerator::defineFunction($function, $this->namespace);
         } elseif (!function_exists('__phpunit_function_mocker_' . $function)) {
             runkit_function_rename($function, '__phpunit_function_mocker_' . $function);
             error_log($function);
             runkit_method_redefine($function, function () use($function) {
                 if (!isset($GLOBALS['__PHPUNIT_EXTENSION_FUNCTIONMOCKER'][$this->namespace])) {
                     return call_user_func_array('__phpunit_function_mocker_' . $function, func_get_args());
                 }
                 return call_user_func_array(array($GLOBALS['__PHPUNIT_EXTENSION_FUNCTIONMOCKER'][$this->namespace], $function), func_get_args());
             });
             var_dump(strlen("foo"));
         }
         static::$mockedFunctions[] = $fqFunction;
     }
     if (!isset($GLOBALS['__PHPUNIT_EXTENSION_FUNCTIONMOCKER'])) {
         $GLOBALS['__PHPUNIT_EXTENSION_FUNCTIONMOCKER'] = array();
     }
     $GLOBALS['__PHPUNIT_EXTENSION_FUNCTIONMOCKER'][$this->namespace] = $mock;
     return $mock;
 }
開發者ID:Dossar,項目名稱:boltbse,代碼行數:29,代碼來源:FunctionMocker.php

示例4: teardown

 function teardown()
 {
     global $conf;
     // restore purge
     if (is_null($this->purge)) {
         unset($_REQUEST['purge']);
     } else {
         $_REQUEST['purge'] = $this->purge;
     }
     // restore $conf['cachedir'] if necessary
     if (!$this->cachedir) {
         unset($conf['cachedir']);
     }
     // restore io_functions
     runkit_function_rename('io_makefiledir', 'xhtml_htmlphp_test_io_makefiledir');
     if (function_exists('io_makefiledir_real')) {
         runkit_function_rename('io_makefiledir_real', 'io_makefiledir');
     }
     runkit_function_rename('io_savefile', 'xhtml_htmlphp_test_io_savefile');
     if (function_exists('io_savefile_real')) {
         runkit_function_rename('io_savefile_real', 'io_savefile');
     }
     // restore GeSHi::parse_code
     runkit_method_remove('GeSHi', 'parse_code');
     runkit_method_rename('GeSHi', 'parse_code_real', 'parse_code');
     parent::setup();
 }
開發者ID:pyfun,項目名稱:dokuwiki,代碼行數:27,代碼來源:xhtml_htmlphp.test.php

示例5: resetFunction

 /**
  *	Reset original function.
  */
 public static function resetFunction($function)
 {
     $originalFunction = "__original_{$function}";
     if (function_exists($originalFunction)) {
         runkit_function_remove($function);
         runkit_function_rename($originalFunction, $function);
     }
 }
開發者ID:v-technologies,項目名稱:transformist,代碼行數:11,代碼來源:Runkit.php

示例6: disable

 /**
  * Disable
  *
  * @return \MockFunction
  */
 public function disable()
 {
     if ($this->active) {
         $this->active = false;
         runkit_function_remove($this->functionName);
         runkit_function_rename($this->functionAlias, $this->functionName);
     }
     return $this;
 }
開發者ID:qubit05,項目名稱:phpunit-mockfunction,代碼行數:14,代碼來源:MockFunction.php

示例7: restore

 /**
  * Restore
  *
  * @return \MockFunction
  */
 public function restore()
 {
     if (!$this->_mock) {
         return $this;
     }
     $this->_mock = false;
     runkit_function_remove($this->_function_name);
     runkit_function_rename($this->_function_alias, $this->_function_name);
     return $this;
 }
開發者ID:lancerhe,項目名稱:phpunit-mock,代碼行數:15,代碼來源:MockFunction.php

示例8: tearDownAfterClass

 public static function tearDownAfterClass()
 {
     if (self::$skipped) {
         return;
     }
     runkit_function_rename('pinba_timer_start', 'pinba_timer_start_callback');
     runkit_function_rename('pinba_timer_stop', 'pinba_timer_stop_callback');
     runkit_function_rename('pinba_timer_start_bak', 'pinba_timer_start');
     runkit_function_rename('pinba_timer_stop_bak', 'pinba_timer_stop');
 }
開發者ID:onphp-framework,項目名稱:onphp-framework,代碼行數:10,代碼來源:PinbaTest.class.php

示例9: tearDown

 public function tearDown()
 {
     if (function_exists('TEST_SAVED_file_get_contents')) {
         runkit_function_remove('file_get_contents');
         runkit_function_rename('TEST_SAVED_file_get_contents', 'file_get_contents');
     }
     if (function_exists('TEST_SAVED_stream_context_create')) {
         runkit_function_remove('stream_context_create');
         runkit_function_rename('TEST_SAVED_stream_context_create', 'stream_context_create');
     }
     self::$fgcReturn = '{}';
 }
開發者ID:evoke-php,項目名稱:eway,代碼行數:12,代碼來源:AccessCodeTest.php

示例10: blackMagicBeforeSuite

 /**
  * @BeforeSuite
  */
 public static function blackMagicBeforeSuite(SuiteEvent $event)
 {
     $parameters = $event->getContextParameters();
     if (false === isset($parameters['customDate'])) {
         throw new \Exception("You don't have customDate in your behat parameters\n");
     }
     global $custom_date;
     self::$_date = $custom_date = $parameters['customDate'];
     $rename = function ($real_name, $fake_name) {
         runkit_function_rename($real_name, "real_{$real_name}");
         runkit_function_rename("ETNA\\FeatureContext\\{$fake_name}", $real_name);
     };
     $rename("time", "fakeTime");
     $rename("date", "fakeDate");
     $rename("strtotime", "fakeStrtotime");
 }
開發者ID:TinyTinyKame,項目名稱:composer-behat-utils,代碼行數:19,代碼來源:FixedTime.php

示例11: override

 /**
  * @param string $f
  */
 protected function override($f)
 {
     runkit_function_rename($f, $f . '_native');
     runkit_function_rename('PHPDaemon\\Thread\\' . $f, $f);
 }
開發者ID:cobolbaby,項目名稱:phpdaemon,代碼行數:8,代碼來源:Worker.php

示例12: runkit_function_add

        runkit_function_add("time", "", <<<FUNC
\t        return original_time() + \$_ENV["{$travelName}"];
FUNC
);
        // replace strtotime()
        runkit_function_rename("strtotime", "original_strtotime");
        runkit_function_add("strtotime", '$time, $now = 0', <<<'FUNC'
	        if (isset($now)
	                && !empty($now))
	            return original_strtotime($time, $now);
	        else
	            return original_strtotime($time, time());
FUNC
);
        // replace date()
        runkit_function_rename("date", "original_date");
        runkit_function_add("date", '$format, $timestamp = 0', <<<'FUNC'
	        if (isset($timestamp)
	                && !empty($timestamp))
	            return original_date($format, $timestamp);
	        else
	            return original_date($format, time());
FUNC
);
        return true;
    };
    if (extension_loaded("uopz")) {
        ini_set("uopz.overloads", 1);
        return $travelByUopz;
    } else {
        if (extension_loaded("runkit")) {
開發者ID:goghcrow,項目名稱:timeTravel,代碼行數:31,代碼來源:timeTravel.php

示例13: revertRedefinedFunction

 /**
  * Revert redefenition of the function
  *
  * @param string $function
  */
 public function revertRedefinedFunction($function)
 {
     $this->checkFunctionExists($function);
     $backupFunction = $this->getBackupName($function);
     try {
         $this->checkFunctionExists($backupFunction);
     } catch (PStub_RunkitAdapter_Exception $e) {
         throw new PStub_RunkitAdapter_Exception('Function ' . $function . ' was never redefined');
     }
     runkit_function_remove($function);
     runkit_function_rename($backupFunction, $function);
 }
開發者ID:realweb-team,項目名稱:pstub,代碼行數:17,代碼來源:RunkitAdapter.php

示例14: restore

 /**
  *    Removes the mock function implementation and restores
  *    the previously declared implementation
  *    @access public
  */
 function restore()
 {
     runkit_function_remove($this->_function) or trigger_error('Error removing mock function', E_USER_ERROR);
     runkit_function_rename($this->_tmp_function, $this->_function) or trigger_error('Error restoring real function', E_USER_ERROR);
 }
開發者ID:pyfun,項目名稱:dokuwiki,代碼行數:10,代碼來源:mock_functions.php

示例15: override

 /**
  * Override a standard PHP function
  * @param string $local e.g. isUploadedFile
  * @param string $real e.g. is_uploaded_file
  */
 protected function override($camelCase, $real)
 {
     runkit_function_rename($real, $real . '_native');
     runkit_function_rename('PHPDaemon\\Thread\\' . $camelCase, $real);
 }
開發者ID:kakserpom,項目名稱:phpdaemon,代碼行數:10,代碼來源:Worker.php


注:本文中的runkit_function_rename函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。