euromark 12 年 前
コミット
6a51e7b38c

+ 1 - 1
Lib/Cache/Engine/MemcachedEngine.php

@@ -232,7 +232,7 @@ class MemcachedEngine extends CacheEngine {
 	public function clear($check) {
 		$keys = array_slice(explode($this->_keySeparator, $this->_Memcached->get($this->_keys)), 1);
 
-		foreach($keys as $key)
+		foreach ($keys as $key)
 			$this->_Memcached->delete($this->settings['prefix'] . $key);
 
 		$this->_Memcached->delete($this->_keys);

+ 1 - 1
Lib/DiffLib.php

@@ -254,7 +254,7 @@ class DiffLib {
 	* Appends or Replaces text
 	* @param array &$text Array of Line objects
 	* @param array $change Array of Change objects
-	* @param int &$offset how many lines to skip due to previous additions
+	* @param integer &$offset how many lines to skip due to previous additions
 	*/
 	public function applyChange(&$text, $change, &$offset = 0) {
 		$index = 0;

+ 1 - 1
Lib/GeocodeLib.php

@@ -757,7 +757,7 @@ class GeocodeLib {
 	 * privacy protection. This way the coordinates will be slightly modified.
 	 *
 	 * @param float coord
-	 * @param int level (0 = nothing to 5 = extrem)
+	 * @param integer level (0 = nothing to 5 = extrem)
 	 * - 1:
 	 * - 2:
 	 * - 3:

+ 6 - 7
Lib/InlineCssLib.php

@@ -123,7 +123,7 @@ class InlineCssLib {
 				array_pop($tags);
 			}
 		}
-		foreach($tags as $tag) {
+		foreach ($tags as $tag) {
 			if ($stripContent) {
 				 $content = '(.+</' . $tag . '[^>]*>|)';
 			}
@@ -150,12 +150,12 @@ class InlineCssLib {
 		// catch <link> style sheet content
 		$links = $DOM->getElementsByTagName('link');
 
-		foreach($links as $link) {
+		foreach ($links as $link) {
 			if ($link->hasAttribute('href') && preg_match("/\.css$/i", $link->getAttribute('href'))) {
 
 				// find the css file and load contents
 				if ($link->hasAttribute('media')) {
-					foreach($this->media_types as $css_link_media) {
+					foreach ($this->media_types as $css_link_media) {
 						if (strstr($link->getAttribute('media'), $css_link_media)) {
 							$css .= $this->_findAndLoadCssFile($link->getAttribute('href')) . "\n\n";
 							$remove_doms[] = $link;
@@ -174,7 +174,7 @@ class InlineCssLib {
 		// Style
 		foreach ($styles as $style) {
 			if ($style->hasAttribute('media')) {
-				foreach($this->media_types as $css_link_media) {
+				foreach ($this->media_types as $css_link_media) {
 					if (strstr($style->getAttribute('media'), $css_link_media)) {
 						$css .= $this->_parseInlineCssAndLoadImports($style->nodeValue);
 						$remove_doms[] = $style;
@@ -214,8 +214,7 @@ class InlineCssLib {
 		for ($i = count($cssHrefs) - 1; $i > 0; $i--) {
 			if (isset($cssHref_paths[count($cssHref_paths) - 1])) {
 				$cssHref_paths[] = $cssHrefs[$i] . DS . $cssHref_paths[count($cssHref_paths) - 1];
-			}
-			else {
+			} else {
 				$cssHref_paths[] = $cssHrefs[$i];
 			}
 		}
@@ -284,7 +283,7 @@ class InlineCssLib {
 					if ($this->import_external_css) {
 						$css .= file_get_contents($url);
 					}
-				}	else {
+				} else {
 					$css .= $this->_findAndLoadCssFile($url);
 				}
 			}

+ 2 - 2
Lib/MyAsset.php

@@ -12,7 +12,7 @@ class MyAsset {
 	/**
 	 * MyAsset::js()
 	 *
-	 * @param bool $setHeaders
+	 * @param boolean $setHeaders
 	 * @return string Script tags.
 	 */
 	public function js($setHeaders = true) {
@@ -29,7 +29,7 @@ class MyAsset {
 	/**
 	 * MyAsset::css()
 	 *
-	 * @param bool $setHeaders
+	 * @param boolean $setHeaders
 	 * @return string Style tags.
 	 */
 	public function css($setHeaders = true) {

+ 1 - 2
Lib/Utility/TextAnalysisLib.php

@@ -288,8 +288,7 @@ class TextAnalysisLib extends TextLib {
 		if (!$this->sen && !$this->r_sen) {
 			@preg_match_all("/[^:|;|\!|\.]+(:|;|\!|\.| )+/", $this->text, $m);
 			$this->sen = count($m[0]);
-			foreach ($m[0] as $s) $this->r_sen[] = strtr(trim($s), array("\n" => '', "\r" =>
-					''));
+			foreach ($m[0] as $s) $this->r_sen[] = strtr(trim($s), array("\n" => '', "\r" => ''));
 		}
 		return $parse ? $this->r_sen : $this->sen;
 	}

+ 3 - 3
Lib/Utility/TextLib.php

@@ -241,7 +241,7 @@ class TextLib extends String {
 	 * </code>
 	 *
 	 * @param string  $value
-	 * @param int     $words
+	 * @param integer     $words
 	 * @param array $options
 	 * - ellipsis
 	 * - html
@@ -323,7 +323,7 @@ class TextLib extends String {
 	 * Converts character entities back to ASCII
 	 *
 	 * @param string
-	 * @param bool
+	 * @param boolean
 	 * @return string
 	 */
 	public function entities_to_ascii($str, $all = true) {
@@ -391,7 +391,7 @@ class TextLib extends String {
 	 *
 	 * @param string
 	 * @param string	the character you wish to reduce
-	 * @param bool	TRUE/FALSE - whether to trim the character from the beginning/end
+	 * @param boolean	TRUE/FALSE - whether to trim the character from the beginning/end
 	 * @return string
 	 */
 	public function reduce_multiples($str, $character = ',', $trim = false) {

+ 5 - 5
Lib/Utility/TimeLib.php

@@ -183,7 +183,7 @@ class TimeLib extends CakeTime {
 			// undefined
 			return array(date('Y') - $year - 1, date('Y') - $year);
 		}
-		if($range[0][0] > date('m') || ($range[0][0] == date('m') && $range[0][1] > date('d'))) {
+		if ($range[0][0] > date('m') || ($range[0][0] == date('m') && $range[0][1] > date('d'))) {
 			// not over
 			return date('Y') - $year - 1;
 		}
@@ -240,7 +240,7 @@ class TimeLib extends CakeTime {
 	/**
 	 * Calendar Week (current week of the year)
 	 * @param date in DB format - if none is passed, current day is used
-	 * @param int relative - weeks relative to the date (+1 next, -1 previous etc)
+	 * @param integer $relative - weeks relative to the date (+1 next, -1 previous etc)
 	 * @TODO: use timestamp - or make the function able to use timestamps at least (besides dateString)
 	 *
 	 * Mit date('W', $time) (großes W!) bekommst die ISO6801-Wochennummer des angegebenen Zeitpunkts, das entspricht der Europäischen Kalenderwoche - mit einer Ausnahme: Daten die zur letzten Kalenderwoche des vorherigen Jahres gehören, liefern die 0 zurück; in dem Fall solltest du dann die KW des 31.12. des Vorjahres ermitteln.
@@ -650,7 +650,7 @@ class TimeLib extends CakeTime {
 
 	/**
 	 * can convert time from one unit to another
-	 * @param int INT | time
+	 * @param integer INT | time
 	 * @param from CHAR
 	 * @param to CHAR
 	 * @param options: acc=>INT [accuracy], showZero=>BOOL, returnArray=>BOOL
@@ -1287,7 +1287,7 @@ class TimeLib extends CakeTime {
 
 	/**
 	 * return strings like 2:30 (later //TODO: or 2:33:99) from seconds etc
-	 * @param int: seconds
+	 * @param integer: seconds
 	 * @return string
 	 * 2011-03-06 ms
 	 */
@@ -1311,7 +1311,7 @@ class TimeLib extends CakeTime {
 
 	/**
 	 * return strings like 2:33:99 from seconds etc
-	 * @param int: seconds
+	 * @param integer: seconds
 	 * @return string
 	 * 2011-03-09 ms
 	 */

+ 1 - 1
Model/Behavior/CaptchaBehavior.php

@@ -208,7 +208,7 @@ class CaptchaBehavior extends ModelBehavior {
 
 	/**
 	 * logs attempts
-	 * @param bool errorsOnly (only if error occured, otherwise always)
+	 * @param boolean ErrorsOnly (only if error occured, otherwise always)
 	 * @returns null if not logged, true otherwise
 	 * 2009-12-18 ms
 	 */

+ 6 - 6
Model/Datasource/ImapSource.php

@@ -525,7 +525,7 @@ class ImapSource extends DataSource {
 	 * you will get a list of the entire mailbox hierarchy. '%' means to return the current level only.
 	 *
 	 * @param Model $Model
-	 * @param bool|string $current
+	 * @param boolean|string $current
 	 * @return array Array containing the names of the mailboxes.
 	 */
 	public function listMailboxes(Model $Model, $current = true) {
@@ -673,7 +673,7 @@ class ImapSource extends DataSource {
 	 *
 	 * @return array
 	 */
-	protected function _makeSearch($Model, $query) {
+	protected function _makeSearch(Model $Model, $query) {
 		$searchCriteria = array();
 
 		if (empty($query['conditions'])) {
@@ -738,7 +738,7 @@ class ImapSource extends DataSource {
 	 *
 	 * @return array
 	 */
-	protected function _makeOrder($Model, $query) {
+	protected function _makeOrder(Model $Model, $query) {
 		$criterias = array(
 			'date',
 			'arrival',
@@ -770,7 +770,7 @@ class ImapSource extends DataSource {
 	 *
 	 * @return mixed or null
 	 */
-	protected function _cond($Model, $query, $field) {
+	protected function _cond(Model $Model, $query, $field) {
 		$keys = array(
 			'`' . $Model->alias . '`.`' . $field . '`',
 			$Model->alias . '.' . $field,
@@ -942,7 +942,7 @@ class ImapSource extends DataSource {
 	 * @param integer $uid the number of the message
 	 * @return array empty on error/nothing or array of formatted details
 	 */
-	protected function _getFormattedMail($Model, $uid, $fetchAttachments = false) {
+	protected function _getFormattedMail(Model $Model, $uid, $fetchAttachments = false) {
 		// Translate uid to msg_no. Has no decent fail
 		$msg_number = imap_msgno($this->Stream, $uid);
 
@@ -1151,7 +1151,7 @@ class ImapSource extends DataSource {
 	 * @param Model $Model
 	 * @return array
 	 */
-	protected function _fetchAttachments($flatStructure, $Model) {
+	protected function _fetchAttachments($flatStructure, Model $Model) {
 		$attachments = array();
 		foreach ($flatStructure as $path => $Part) {
 			if (!$Part->isAttachment) {

+ 2 - 2
Model/MyModel.php

@@ -1620,7 +1620,7 @@ class MyModel extends Model {
 	 *
 	 * @deprecated use atomic updateAll() instead!
 	 * @param string fieldname
-	 * @param int factor: defaults to 1 (could be negative as well - if field is signed and can be < 0)
+	 * @param integer factor: defaults to 1 (could be negative as well - if field is signed and can be < 0)
 	 */
 	public function inc($field, $factor = 1) {
 		$value = Set::extract($this->read($field), $this->alias . '.' . $field);
@@ -1631,7 +1631,7 @@ class MyModel extends Model {
 	/**
 	 * Toggles Field (Important/Deleted/Primary etc)
 	 * @param STRING fieldName
-	 * @param INT id (cleaned!)
+	 * @param integer id (cleaned!)
 	 * @return ARRAY record: [Model][values],...
 	 * AJAX?
 	 * 2008-11-06 ms

+ 4 - 3
Test/Case/Lib/Utility/TimeLibTest.php

@@ -480,8 +480,9 @@ class TimeLibTest extends MyCakeTestCase {
 		App::uses('ZodiacLib', 'Tools.Misc');
 
 		$is = TimeLib::ageByHoroscope(2000, ZodiacLib::SIGN_VIRGO);
-		//pr($is);
-		$this->assertEquals(date('Y') - 2000 - 1, $is);
+		// between xxxx-08-24 and xxxx-09-23 the latter, otherwise the first:
+		//$this->assertEquals(date('Y') - 2000 - 1, $is);
+		//$this->assertEquals(array(date('Y') - 2000 - 1, date('Y') - 2000), $is);
 
 		$is = TimeLib::ageByHoroscope(1991, ZodiacLib::SIGN_LIBRA);
 		//pr($is);
@@ -489,7 +490,7 @@ class TimeLibTest extends MyCakeTestCase {
 
 		$is = TimeLib::ageByHoroscope(1986, ZodiacLib::SIGN_CAPRICORN);
 		//pr($is);
-		$this->assertEquals($is, array(date('Y') - 1986 - 1, date('Y') - 1986));
+		$this->assertEquals(array(date('Y') - 1986 - 1, date('Y') - 1986), $is);
 
 		$is = TimeLib::ageByHoroscope(2000, ZodiacLib::SIGN_SCORPIO);
 		//debug($is); ob_flush();

+ 12 - 12
Test/Case/Model/Behavior/SluggedBehaviorTest.php

@@ -256,11 +256,11 @@ class SluggedBehaviorTest extends CakeTestCase {
 	public function testBuildRegex() {
 		$chars = array();
 		$string = '';
-		for($hex1 = 0; $hex1 < 16; $hex1++) {
-			for($hex2 = 0; $hex2 < 16; $hex2++) {
-				for($hex3 = 0; $hex3 < 16; $hex3++) {
+		for ($hex1 = 0; $hex1 < 16; $hex1++) {
+			for ($hex2 = 0; $hex2 < 16; $hex2++) {
+				for ($hex3 = 0; $hex3 < 16; $hex3++) {
 					$string .= dechex($hex1) . dechex($hex2) . dechex($hex3) . dechex(0);
-					for($hex4 = 0; $hex4 < 16; $hex4++) {
+					for ($hex4 = 0; $hex4 < 16; $hex4++) {
 						$hexCode = dechex($hex1) . dechex($hex2) . dechex($hex3) . dechex($hex4);
 						$decCode = hexdec($hexCode);
 						$string .= $display = $char = html_entity_decode('&#' . $decCode . ';', ENT_NOQUOTES, 'UTF-8');
@@ -320,7 +320,7 @@ class SluggedBehaviorTest extends CakeTestCase {
 		@unlink($path);
 		$file = new File($path, true);
 		$file->append('class SluggedTest extends CakeTestCase {' . "\n");
-		for($hex1 = $hex1Start; $hex1 < $hex1Limit; $hex1++) {
+		for ($hex1 = $hex1Start; $hex1 < $hex1Limit; $hex1++) {
 			if (in_array($hex1, $skip)) {
 				continue;
 			}
@@ -340,10 +340,10 @@ class SluggedBehaviorTest extends CakeTestCase {
 	protected function _buildTestFunction($section, $limit = 16, $start = 0) {
 		$out = "\tfunction testSection$section() {\n";
 		$allEmpty = true;
-		for($hex1 = $start; $hex1 < $limit; $hex1++) {
-			for($hex2 = 0; $hex2 < 16; $hex2++) {
+		for ($hex1 = $start; $hex1 < $limit; $hex1++) {
+			for ($hex2 = 0; $hex2 < 16; $hex2++) {
 				$string = '';
-				for($hex3 = 0; $hex3 < 16; $hex3++) {
+				for ($hex3 = 0; $hex3 < 16; $hex3++) {
 					$hexCode = $section . dechex($hex1) . dechex($hex2) . dechex($hex3);
 					$decCode = hexdec($hexCode);
 					if ($decCode <= 31 || ($decCode >= 127 && $decCode <= 159) || ($hexCode >= 'd800' && $hexCode <= 'dfff') || $hexCode >= 'fffe') {
@@ -410,12 +410,12 @@ class SluggedBehaviorTest extends CakeTestCase {
  * @access protected
  */
 	protected function _testMode($mode, $hex1Limit = 16, $hex2Limit = 16, $hex1Start = 0, $hex2Start = 0) {
-		for($hex1 = $hex1Start; $hex1 < $hex1Limit; $hex1++) {
+		for ($hex1 = $hex1Start; $hex1 < $hex1Limit; $hex1++) {
 			$suffix = dechex($hex1) . dechex($hex2Start) . '_' . dechex($hex1) . dechex($hex2Limit -1);
 			$full = TMP . 'tests' . DS . 'slug_' . $mode . '_' . $suffix . '.html';
 			$file = new File($full, true);
 			$this->_writeHeader($file, $hex1);
-			for($hex2 = $hex2Start; $hex2 < $hex2Limit; $hex2++) {
+			for ($hex2 = $hex2Start; $hex2 < $hex2Limit; $hex2++) {
 				$part = file_get_contents($this->_createTestFile(dechex($hex1) . dechex($hex2), $mode));
 				preg_match('@<table>(.*)</table>@Us', $part, $test);
 				$file->append($test[1] . "\n");
@@ -527,13 +527,13 @@ class SluggedBehaviorTest extends CakeTestCase {
 		$path = TMP . 'tests' . DS . '_slug_' . $mode . '_' . $section . '.html';
 		$file = new File($path, true);
 		$this->_writeHeader($file, $section);
-		for($hex1 = -1; $hex1 < 16; $hex1++) {
+		for ($hex1 = -1; $hex1 < 16; $hex1++) {
 			if ($hex1 == -1) {
 				$row = array('<b>' . $section . '</b>');
 			} else {
 				$row = array($section . dechex($hex1) . 0);
 			}
-			for($hex2 = 0; $hex2 < 16; $hex2++) {
+			for ($hex2 = 0; $hex2 < 16; $hex2++) {
 				if ($hex1 == -1) {
 					$row[] = $section . dechex($hex2);
 				} else {

+ 1 - 1
TestSuite/MyCakeTestCase.php

@@ -144,7 +144,7 @@ abstract class MyCakeTestCase extends CakeTestCase {
 
 	/**
 	 * @param float $time
-	 * @param int precision
+	 * @param integer precision
 	 * @param boolean $secs: usually in milliseconds (for long times set it to 'true')
 	 * 2009-07-20 ms
 	 */

+ 1 - 1
View/Helper/CaptchaHelper.php

@@ -121,7 +121,7 @@ class CaptchaHelper extends AppHelper {
 	 * either combined with between=true (all in this one funtion)
 	 * or seperated by =false (needs input(false) and captcha() calls then)
 	 *
-	 * @param bool between: [default: true]
+	 * @param boolean between: [default: true]
 	 * @return string HTML
 	 * 2010-01-08 ms
 	 */

+ 2 - 2
View/Helper/CommonHelper.php

@@ -407,7 +407,7 @@ class CommonHelper extends AppHelper {
 			$html = '<div class="flashMessages">';
 
 			if ($unsorted !== true) {
-				// Add a div for each message using the type as the class
+				// Add a div for each message using the type as the class.
 				foreach ($messages as $type => $msgs) {
 					foreach ((array)$msgs as $msg) {
 						$html .= $this->_message($msg, $type);
@@ -547,7 +547,7 @@ function getInternetExplorerVersion() {
 	return rv;
 }
 
-if ((document.all) && (navigator.appVersion.indexOf("MSIE 7.") != -1) || typeof document.body.style.maxHeight == "undefined") {
+if ((document.all) && (navigator.appVersion.indexOf("MSIE 7.") != -1) || typeof document.body.style.maxHeight == 'undefined') {
 	document.getElementById(\''.$id.'\').innerHTML = \''.$message.'\';
 }
 /*

+ 2 - 2
View/Helper/FormatHelper.php

@@ -586,7 +586,7 @@ class FormatHelper extends TextHelper {
 
 		// additionally there could be a span tag in between: email<span syle="display:none"></span>@web.de
 		$querystring = '';
-		foreach ($params as $key=>$val) {
+		foreach ($params as $key => $val) {
 			if ($querystring) {
 				$querystring .= "&$key=" . rawurlencode($val);
 			} else {
@@ -1229,7 +1229,7 @@ class FormatHelper extends TextHelper {
 	/**
 	 * (intelligent) Shortening of a text string
 	 * @param STRING textstring
-	 * @param INT chars = max-length
+	 * @param integer chars = max-length
 	 * For options array:
 	 * @param BOOLEAN strict (default: FALSE = intelligent shortening, cutting only between whole words)
 	 * @param STRING ending (default: '...' no leading whitespace)

+ 3 - 3
View/Helper/GoogleMapV3Helper.php

@@ -973,9 +973,9 @@ var iconShape = {
 		);
 		$options += $defaults;
 
-		if( !isset($strokeColor) )		$strokeColor = $this->defaultStrokeColor;
-		if( !isset($strokeOpacity) )	$strokeOpacity = $this->defaultStrokeOpacity;
-		if( !isset($strokeWeight) )		$strokeWeight = $this->defaultStrokeWeight;
+		if ( !isset($strokeColor) )		$strokeColor = $this->defaultStrokeColor;
+		if ( !isset($strokeOpacity) )	$strokeOpacity = $this->defaultStrokeOpacity;
+		if ( !isset($strokeWeight) )		$strokeWeight = $this->defaultStrokeWeight;
 
 		$id = 'p' . self::$MARKER_COUNT++;
 

+ 1 - 1
View/Helper/GravatarHelper.php

@@ -90,7 +90,7 @@ class GravatarHelper extends AppHelper {
 	 * GravatarHelper::url()
 	 *
 	 * @param mixed $email
-	 * @param bool $options
+	 * @param boolean $options
 	 * @return void
 	 * @deprecated Use imageUrl() instead.
 	 */

+ 1 - 1
View/Helper/TypographyHelper.php

@@ -55,7 +55,7 @@ class TypographyHelper extends AppHelper {
 	 * - Converts two spaces into entities
 	 *
 	 * @param string
-	 * @param bool	whether to reduce more then two consecutive newlines to two
+	 * @param boolean Whether to reduce more then two consecutive newlines to two
 	 * @return string
 	 */
 	public function autoTypography($str, $reduce_linebreaks = false) {