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


PHP Inflector::reset方法代碼示例

本文整理匯總了PHP中Inflector::reset方法的典型用法代碼示例。如果您正苦於以下問題:PHP Inflector::reset方法的具體用法?PHP Inflector::reset怎麽用?PHP Inflector::reset使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Inflector的用法示例。


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

示例1: variable

     */
    public static function variable($string)
    {
        if (!($result = self::_cache(__FUNCTION__, $string))) {
            $camelized = Inflector::camelize(Inflector::underscore($string));
            $replace = strtolower(substr($camelized, 0, 1));
            $result = preg_replace('/\\w/', $replace, $camelized, 1);
            self::_cache(__FUNCTION__, $string, $result);
        }
        return $result;
    }
    /**
     * Returns a string with all spaces converted to underscores (by default), accented
     * characters converted to non-accented characters, and non word characters removed.
     *
     * @param string $string the string you want to slug
     * @param string $replacement will replace keys in map
     * @return string
     * @link http://book.cakephp.org/2.0/en/core-utility-libraries/inflector.html#Inflector::slug
     */
    public static function slug($string, $replacement = '_')
    {
        $quotedReplacement = preg_quote($replacement, '/');
        $merge = array('/[^\\s\\p{Zs}\\p{Ll}\\p{Lm}\\p{Lo}\\p{Lt}\\p{Lu}\\p{Nd}]/mu' => ' ', '/[\\s\\p{Zs}]+/mu' => $replacement, sprintf('/^[%s]+|[%s]+$/', $quotedReplacement, $quotedReplacement) => '');
        $map = self::$_transliteration + $merge;
        return preg_replace(array_keys($map), array_values($map), $string);
    }
}
// Store the initial state
Inflector::reset();
開發者ID:dudasc,項目名稱:site-fescjj,代碼行數:30,代碼來源:Inflector.php

示例2: tearDown

 public function tearDown()
 {
     Inflector::reset();
 }
開發者ID:chriskite,項目名稱:phactory,代碼行數:4,代碼來源:InflectorTest.php

示例3: tearDown

/**
 * teardown
 *
 * @return void
 */
	public function tearDown() {
		parent::tearDown();
		Inflector::reset();
	}
開發者ID:sherix88,項目名稱:sigedu,代碼行數:9,代碼來源:InflectorTest.php

示例4: reset

 /**
  * Delete created objects from the database, clear defined
  * blueprints, and clear stored inflection exceptions.
  */
 public function reset()
 {
     $this->recall();
     $this->_blueprints = [];
     Inflector::reset();
 }
開發者ID:BaguettePHP,項目名稱:phactory,代碼行數:10,代碼來源:Phactory.php


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