Skip to content

Commit

Permalink
Infector::_cache is a protected method and no need be singleton.
Browse files Browse the repository at this point in the history
  • Loading branch information
jrbasso authored and lorenzo committed Jan 20, 2010
1 parent d2d19ee commit 8d5acf0
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions cake/libs/inflector.php
Expand Up @@ -253,19 +253,17 @@ function &getInstance() {
* @access protected
*/
function _cache($type, $key, $value = false) {
$_this =& Inflector::getInstance();

$key = '_' . $key;
$type = '_' . $type;
if ($value !== false) {
$_this->{$type}[$key] = $value;
$this->{$type}[$key] = $value;
return $value;
}

if (!isset($_this->{$type}[$key])) {
if (!isset($this->{$type}[$key])) {
return false;
}
return $_this->{$type}[$key];
return $this->{$type}[$key];
}

/**
Expand Down Expand Up @@ -328,8 +326,8 @@ function pluralize($word) {
}

if (!isset($_this->_plural['cacheUninflected']) || !isset($_this->_plural['cacheIrregular'])) {
$_this->_plural['cacheUninflected'] = '(?:' . join( '|', $_this->_plural['merged']['uninflected']) . ')';
$_this->_plural['cacheIrregular'] = '(?:' . join( '|', array_keys($_this->_plural['merged']['irregular'])) . ')';
$_this->_plural['cacheUninflected'] = '(?:' . implode('|', $_this->_plural['merged']['uninflected']) . ')';
$_this->_plural['cacheIrregular'] = '(?:' . implode('|', array_keys($_this->_plural['merged']['irregular'])) . ')';
}

if (preg_match('/(.*)\\b(' . $_this->_plural['cacheIrregular'] . ')$/i', $word, $regs)) {
Expand Down

0 comments on commit 8d5acf0

Please sign in to comment.