本文整理匯總了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();
示例2: tearDown
public function tearDown()
{
Inflector::reset();
}
示例3: tearDown
/**
* teardown
*
* @return void
*/
public function tearDown() {
parent::tearDown();
Inflector::reset();
}
示例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();
}