rename protected variable to $_engine

This commit is contained in:
Rachman Chavik 2012-02-14 23:14:18 +07:00
parent fe479c636c
commit 5eb1979b04
6 changed files with 53 additions and 53 deletions

View file

@ -26,11 +26,11 @@ App::uses('NumberHelper', 'View/Helper');
class NumberHelperTestObject extends NumberHelper {
public function attach(CakeNumberMock $cakeNumber) {
$this->_CakeNumber = $cakeNumber;
$this->_engine = $cakeNumber;
}
public function engine() {
return $this->_CakeNumber;
return $this->_engine;
}
}

View file

@ -23,11 +23,11 @@ App::uses('TextHelper', 'View/Helper');
class TextHelperTestObject extends TextHelper {
public function attach(StringMock $string) {
$this->_String = $string;
$this->_engine = $string;
}
public function engine() {
return $this->_String;
return $this->_engine;
}
}

View file

@ -26,11 +26,11 @@ App::uses('CakeTime', 'Utility');
class TimeHelperTestObject extends TimeHelper {
public function attach(CakeTimeMock $cakeTime) {
$this->_CakeTime = $cakeTime;
$this->_engine = $cakeTime;
}
public function engine() {
return $this->_CakeTime;
return $this->_engine;
}
}

View file

@ -35,7 +35,7 @@ class NumberHelper extends AppHelper {
/** CakeNumber instance
*/
protected $_CakeNumber = null;
protected $_engine = null;
/* Default Constructor
*
@ -48,7 +48,7 @@ class NumberHelper extends AppHelper {
list($plugin, $engineClass) = pluginSplit($settings['engine'], true);
App::uses($engineClass, $plugin . 'Utility');
if (class_exists($engineClass)) {
$this->_CakeNumber = new $engineClass($settings);
$this->_engine = new $engineClass($settings);
} else {
throw new CakeException(__d('cake_dev', '%s could not be found', $engineClass));
}
@ -58,7 +58,7 @@ class NumberHelper extends AppHelper {
* Call methods from CakeNumber utility class
*/
public function __call($method, $params) {
return call_user_func_array(array($this->_CakeNumber, $method), $params);
return call_user_func_array(array($this->_engine, $method), $params);
}
/**
@ -70,7 +70,7 @@ class NumberHelper extends AppHelper {
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/number.html#NumberHelper::precision
*/
public function precision($number, $precision = 3) {
return $this->_CakeNumber->precision($number, $precision);
return $this->_engine->precision($number, $precision);
}
/**
@ -81,7 +81,7 @@ class NumberHelper extends AppHelper {
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/number.html#NumberHelper::toReadableSize
*/
public function toReadableSize($size) {
return $this->_CakeNumber->toReadableSize($size);
return $this->_engine->toReadableSize($size);
}
/**
@ -93,7 +93,7 @@ class NumberHelper extends AppHelper {
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/number.html#NumberHelper::toPercentage
*/
public function toPercentage($number, $precision = 2) {
return $this->_CakeNumber->toPercentage($number, $precision);
return $this->_engine->toPercentage($number, $precision);
}
/**
@ -106,7 +106,7 @@ class NumberHelper extends AppHelper {
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/number.html#NumberHelper::format
*/
public function format($number, $options = false) {
return $this->_CakeNumber->format($number, $options);
return $this->_engine->format($number, $options);
}
/**
@ -120,7 +120,7 @@ class NumberHelper extends AppHelper {
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/number.html#NumberHelper::currency
*/
public function currency($number, $currency = 'USD', $options = array()) {
return $this->_CakeNumber->currency($number, $currency, $options);
return $this->_engine->currency($number, $currency, $options);
}
/**
@ -133,7 +133,7 @@ class NumberHelper extends AppHelper {
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/number.html#NumberHelper::addFormat
*/
public function addFormat($formatName, $options) {
return $this->_CakeNumber->addFormat($formatName, $options);
return $this->_engine->addFormat($formatName, $options);
}
}

View file

@ -51,7 +51,7 @@ class TextHelper extends AppHelper {
/**
* String utility instance
*/
protected $_String;
protected $_engine;
/**
* Constructor
@ -65,7 +65,7 @@ class TextHelper extends AppHelper {
list($plugin, $engineClass) = pluginSplit($settings['engine'], true);
App::uses($engineClass, $plugin . 'Utility');
if (class_exists($engineClass)) {
$this->_String = new $engineClass($settings);
$this->_engine = new $engineClass($settings);
} else {
throw new CakeException(__d('cake_dev', '%s could not be found', $engineClass));
}
@ -75,7 +75,7 @@ class TextHelper extends AppHelper {
* Call methods from String utility class
*/
public function __call($method, $params) {
return call_user_func_array(array($this->_String, $method), $params);
return call_user_func_array(array($this->_engine, $method), $params);
}
/**
@ -214,7 +214,7 @@ class TextHelper extends AppHelper {
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/text.html#TextHelper::highlight
*/
public function highlight($text, $phrase, $options = array()) {
return $this->_String->highlight($text, $phrase, $options);
return $this->_engine->highlight($text, $phrase, $options);
}
/**
@ -225,7 +225,7 @@ class TextHelper extends AppHelper {
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/text.html#TextHelper::stripLinks
*/
public function stripLinks($text) {
return $this->_String->stripLinks($text);
return $this->_engine->stripLinks($text);
}
/**
@ -238,7 +238,7 @@ class TextHelper extends AppHelper {
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/text.html#TextHelper::truncate
*/
public function truncate($text, $length = 100, $options = array()) {
return $this->_String->truncate($text, $length, $options);
return $this->_engine->truncate($text, $length, $options);
}
/**
@ -252,7 +252,7 @@ class TextHelper extends AppHelper {
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/text.html#TextHelper::excerpt
*/
public function excerpt($text, $phrase, $radius = 100, $ending = '...') {
return $this->_String->excerpt($text, $phrase, $radius, $ending);
return $this->_engine->excerpt($text, $phrase, $radius, $ending);
}
/**
@ -265,7 +265,7 @@ class TextHelper extends AppHelper {
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/text.html#TextHelper::toList
*/
public function toList($list, $and = 'and', $separator = ', ') {
return $this->_String->toList($list, $and, $separator);
return $this->_engine->toList($list, $and, $separator);
}
}

View file

@ -35,7 +35,7 @@ class TimeHelper extends AppHelper {
/**
* CakeTime instance
*/
protected $_CakeTime = null;
protected $_engine = null;
/**
* Constructor
@ -49,7 +49,7 @@ class TimeHelper extends AppHelper {
list($plugin, $engineClass) = pluginSplit($settings['engine'], true);
App::uses($engineClass, $plugin . 'Utility');
if (class_exists($engineClass)) {
$this->_CakeTime = new $engineClass($settings);
$this->_engine = new $engineClass($settings);
} else {
throw new CakeException(__d('cake_dev', '%s could not be found', $engineClass));
}
@ -65,7 +65,7 @@ class TimeHelper extends AppHelper {
public function __set($name, $value) {
switch ($name) {
case 'niceFormat':
$this->_CakeTime->{$name} = $value;
$this->_engine->{$name} = $value;
break;
default:
$this->{$name} = $value;
@ -97,12 +97,12 @@ class TimeHelper extends AppHelper {
* @return mixed
*/
public function __get($name) {
if (isset($this->_CakeTime->{$name})) {
return $this->_CakeTime->{$name};
if (isset($this->_engine->{$name})) {
return $this->_engine->{$name};
}
$magicGet = array('niceFormat');
if (in_array($name, $magicGet)) {
return $this->_CakeTime->{$name};
return $this->_engine->{$name};
}
return null;
}
@ -111,7 +111,7 @@ class TimeHelper extends AppHelper {
* Call methods from CakeTime utility class
*/
public function __call($method, $params) {
return call_user_func_array(array($this->_CakeTime, $method), $params);
return call_user_func_array(array($this->_engine, $method), $params);
}
/**
@ -124,7 +124,7 @@ class TimeHelper extends AppHelper {
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/time.html#formatting
*/
public function convertSpecifiers($format, $time = null) {
return $this->_CakeTime->convertSpecifiers($format, $time);
return $this->_engine->convertSpecifiers($format, $time);
}
/**
@ -136,7 +136,7 @@ class TimeHelper extends AppHelper {
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/time.html#formatting
*/
public function convert($serverTime, $userOffset) {
return $this->_CakeTime->convert($serverTime, $userOffset);
return $this->_engine->convert($serverTime, $userOffset);
}
/**
@ -146,7 +146,7 @@ class TimeHelper extends AppHelper {
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/time.html#formatting
*/
public function serverOffset() {
return $this->_CakeTime->serverOffset();
return $this->_engine->serverOffset();
}
/**
@ -158,7 +158,7 @@ class TimeHelper extends AppHelper {
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/time.html#formatting
*/
public function fromString($dateString, $userOffset = null) {
return $this->_CakeTime->fromString($dateString, $userOffset);
return $this->_engine->fromString($dateString, $userOffset);
}
/**
@ -171,7 +171,7 @@ class TimeHelper extends AppHelper {
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/time.html#formatting
*/
public function nice($dateString = null, $userOffset = null, $format = null) {
return $this->_CakeTime->nice($dateString, $userOffset, $format);
return $this->_engine->nice($dateString, $userOffset, $format);
}
/**
@ -183,7 +183,7 @@ class TimeHelper extends AppHelper {
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/time.html#formatting
*/
public function niceShort($dateString = null, $userOffset = null) {
return $this->_CakeTime->niceShort($dateString, $userOffset);
return $this->_engine->niceShort($dateString, $userOffset);
}
/**
@ -197,7 +197,7 @@ class TimeHelper extends AppHelper {
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/time.html#formatting
*/
public function daysAsSql($begin, $end, $fieldName, $userOffset = null) {
return $this->_CakeTime->daysAsSql($begin, $end, $fieldName, $userOffset);
return $this->_engine->daysAsSql($begin, $end, $fieldName, $userOffset);
}
/**
@ -210,7 +210,7 @@ class TimeHelper extends AppHelper {
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/time.html#formatting
*/
public function dayAsSql($dateString, $fieldName, $userOffset = null) {
return $this->_CakeTime->dayAsSql($dateString, $fieldName, $userOffset);
return $this->_engine->dayAsSql($dateString, $fieldName, $userOffset);
}
/**
@ -222,7 +222,7 @@ class TimeHelper extends AppHelper {
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/time.html#testing-time
*/
public function isToday($dateString, $userOffset = null) {
return $this->_CakeTime->isToday($dateString, $userOffset);
return $this->_engine->isToday($dateString, $userOffset);
}
/**
@ -234,7 +234,7 @@ class TimeHelper extends AppHelper {
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/time.html#testing-time
*/
public function isThisWeek($dateString, $userOffset = null) {
return $this->_CakeTime->isThisWeek($dateString, $userOffset);
return $this->_engine->isThisWeek($dateString, $userOffset);
}
/**
@ -246,7 +246,7 @@ class TimeHelper extends AppHelper {
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/time.html#testing-time
*/
public function isThisMonth($dateString, $userOffset = null) {
return $this->_CakeTime->isThisMonth($dateString, $userOffset);
return $this->_engine->isThisMonth($dateString, $userOffset);
}
/**
@ -258,7 +258,7 @@ class TimeHelper extends AppHelper {
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/time.html#testing-time
*/
public function isThisYear($dateString, $userOffset = null) {
return $this->_CakeTime->isThisYear($dateString, $userOffset);
return $this->_engine->isThisYear($dateString, $userOffset);
}
/**
@ -271,7 +271,7 @@ class TimeHelper extends AppHelper {
*
*/
public function wasYesterday($dateString, $userOffset = null) {
return $this->_CakeTime->wasYesterday($dateString, $userOffset);
return $this->_engine->wasYesterday($dateString, $userOffset);
}
/**
@ -283,7 +283,7 @@ class TimeHelper extends AppHelper {
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/time.html#testing-time
*/
public function isTomorrow($dateString, $userOffset = null) {
return $this->_CakeTime->isTomorrow($dateString, $userOffset);
return $this->_engine->isTomorrow($dateString, $userOffset);
}
/**
@ -295,7 +295,7 @@ class TimeHelper extends AppHelper {
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/time.html#formatting
*/
public function toQuarter($dateString, $range = false) {
return $this->_CakeTime->toQuarter($dateString, $range);
return $this->_engine->toQuarter($dateString, $range);
}
/**
@ -307,7 +307,7 @@ class TimeHelper extends AppHelper {
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/time.html#formatting
*/
public function toUnix($dateString, $userOffset = null) {
return $this->_CakeTime->toUnix($dateString, $userOffset);
return $this->_engine->toUnix($dateString, $userOffset);
}
/**
@ -319,7 +319,7 @@ class TimeHelper extends AppHelper {
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/time.html#formatting
*/
public function toAtom($dateString, $userOffset = null) {
return $this->_CakeTime->toAtom($dateString, $userOffset);
return $this->_engine->toAtom($dateString, $userOffset);
}
/**
@ -331,7 +331,7 @@ class TimeHelper extends AppHelper {
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/time.html#formatting
*/
public function toRSS($dateString, $userOffset = null) {
return $this->_CakeTime->toRSS($dateString, $userOffset);
return $this->_engine->toRSS($dateString, $userOffset);
}
/**
@ -343,7 +343,7 @@ class TimeHelper extends AppHelper {
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/time.html#formatting
*/
public function timeAgoInWords($dateTime, $options = array()) {
return $this->_CakeTime->timeAgoInWords($dateTime, $options);
return $this->_engine->timeAgoInWords($dateTime, $options);
}
/**
@ -357,7 +357,7 @@ class TimeHelper extends AppHelper {
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/time.html#testing-time
*/
public function wasWithinLast($timeInterval, $dateString, $userOffset = null) {
return $this->_CakeTime->wasWithinLast($timeInterval, $dateString, $userOffset);
return $this->_engine->wasWithinLast($timeInterval, $dateString, $userOffset);
}
/**
@ -368,7 +368,7 @@ class TimeHelper extends AppHelper {
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/time.html#formatting
*/
public function gmt($string = null) {
return $this->_CakeTime->gmt($string);
return $this->_engine->gmt($string);
}
/**
@ -382,7 +382,7 @@ class TimeHelper extends AppHelper {
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/time.html#formatting
*/
public function format($format, $date = null, $invalid = false, $userOffset = null) {
return $this->_CakeTime->format($format, $date, $invalid, $userOffset);
return $this->_engine->format($format, $date, $invalid, $userOffset);
}
/**
@ -396,7 +396,7 @@ class TimeHelper extends AppHelper {
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/time.html#formatting
*/
public function i18nFormat($date, $format = null, $invalid = false, $userOffset = null) {
return $this->_CakeTime->i18nFormat($date, $format, $invalid, $userOffset);
return $this->_engine->i18nFormat($date, $format, $invalid, $userOffset);
}
}