Skip to content
This repository
Browse code

Renaming inflector regex cache.

  • Loading branch information...
commit b5633937522c213981fc76b2e268ac89c86a703d 1 parent 7bc9489
Joel Perras authored March 17, 2009

Showing 1 changed file with 11 additions and 11 deletions. Show diff stats Hide diff stats

  1. 22  cake/libs/inflector.php
22  cake/libs/inflector.php
@@ -216,7 +216,7 @@ function rules($type, $rules = array()) {
216 216
     foreach ($rules as $rule => $pattern) {
217 217
         if (is_array($pattern)) {
218 218
           $_this->{$type}[$rule] = array_merge($pattern, $_this->{$type}[$rule]);
219  
-          unset($rules[$rule], $_this->{$type}['regex' . ucfirst($rule)]);
  219
+          unset($rules[$rule], $_this->{$type}['cache' . ucfirst($rule)]);
220 220
         }
221 221
     }
222 222
     $_this->{$type}['rules'] = array_merge($rules, $_this->{$type}['rules']);
@@ -239,17 +239,17 @@ function pluralize($word) {
239 239
 		extract($_this->plural);
240 240
     	$uninflected = array_merge($uninflected, $_this->uninflected);
241 241
 
242  
-    	if (!isset($_this->plural['regexUninflected']) || !isset($_this->plural['regexIrregular'])) {
243  
-			$_this->plural['regexUninflected'] = '(?:' . join( '|', $uninflected) . ')';
244  
-			$_this->plural['regexIrregular'] = '(?:' . join( '|', array_keys($irregular)) . ')';
  242
+    	if (!isset($_this->plural['cacheUninflected']) || !isset($_this->plural['cacheIrregular'])) {
  243
+			$_this->plural['cacheUninflected'] = '(?:' . join( '|', $uninflected) . ')';
  244
+			$_this->plural['cacheIrregular'] = '(?:' . join( '|', array_keys($irregular)) . ')';
245 245
 		}
246 246
 
247  
-		if (preg_match('/(.+?)\\b(' . $_this->plural['regexIrregular'] . ')$/i', $word, $regs)) {
  247
+		if (preg_match('/(.+?)\\b(' . $_this->plural['cacheIrregular'] . ')$/i', $word, $regs)) {
248 248
 			$_this->pluralized[$word] = $regs[1] . substr($word, 0, 1) . substr($irregular[strtolower($regs[2])], 1);
249 249
 			return $_this->pluralized[$word];
250 250
 		}
251 251
 
252  
-		if (preg_match('/^(' . $_this->plural['regexUninflected'] . ')$/i', $word, $regs)) {
  252
+		if (preg_match('/^(' . $_this->plural['cacheUninflected'] . ')$/i', $word, $regs)) {
253 253
 			$_this->pluralized[$word] = $word;
254 254
 			return $word;
255 255
 		}
@@ -282,17 +282,17 @@ function singularize($word) {
282 282
     	$uninflected = array_merge($uninflected, $_this->uninflected);
283 283
     	$irregular = array_flip($_this->plural['irregular']);
284 284
 
285  
-		if (!isset($_this->singular['regexUninflected']) || !isset($_this->singular['regexIrregular'])) {
286  
-			$_this->singular['regexUninflected'] = '(?:' . join( '|', $uninflected) . ')';
287  
-        	$_this->singular['regexIrregular'] = '(?:' . join( '|', array_keys($irregular)) . ')';
  285
+		if (!isset($_this->singular['cacheUninflected']) || !isset($_this->singular['cacheIrregular'])) {
  286
+			$_this->singular['cacheUninflected'] = '(?:' . join( '|', $uninflected) . ')';
  287
+        	$_this->singular['cacheIrregular'] = '(?:' . join( '|', array_keys($irregular)) . ')';
288 288
 		}
289 289
 
290  
-		if (preg_match('/(.+?)\\b(' . $_this->singular['regexUninflected'] . ')$/i', $word, $regs)) {
  290
+		if (preg_match('/(.+?)\\b(' . $_this->singular['cacheUninflected'] . ')$/i', $word, $regs)) {
291 291
 			$_this->singularized[$word] = $regs[1] . substr($word, 0, 1) . substr($irregular[strtolower($regs[2])], 1);
292 292
 			return $_this->singularized[$word];
293 293
 		}
294 294
 
295  
-		if (preg_match('/^(' . $_this->singular['regexUninflected'] . ')$/i', $word, $regs)) {
  295
+		if (preg_match('/^(' . $_this->singular['cacheUninflected'] . ')$/i', $word, $regs)) {
296 296
 			$_this->singularized[$word] = $word;
297 297
 			return $word;
298 298
 		}

0 notes on commit b563393

Please sign in to comment.
Something went wrong with that request. Please try again.