mscherer 9 年之前
父节点
当前提交
0155756c90
共有 4 个文件被更改,包括 16 次插入8 次删除
  1. 2 1
      config/bootstrap.php
  2. 4 2
      src/Model/Behavior/SluggedBehavior.php
  3. 4 2
      src/Utility/L10n.php
  4. 6 3
      tests/TestCase/Mailer/EmailTest.php

+ 2 - 1
config/bootstrap.php

@@ -159,7 +159,8 @@ function entDec($text, $quoteStyle = ENT_QUOTES) {
  * @return mixed
  */
 function extractFileInfo($filename, $type = null) {
-	if ($info = extractPathInfo($filename, $type)) {
+	$info = extractPathInfo($filename, $type);
+	if ($info) {
 		return $info;
 	}
 	$pos = strrpos($filename, '.');

+ 4 - 2
src/Model/Behavior/SluggedBehavior.php

@@ -248,7 +248,8 @@ class SluggedBehavior extends Behavior {
 		$separator = $this->_config['separator'];
 
 		$string = str_replace(["\r\n", "\r", "\n"], ' ', $value);
-		if ($replace = $this->_config['replace']) {
+		$replace = $this->_config['replace'];
+		if ($replace) {
 			$string = str_replace(array_keys($replace), array_values($replace), $string);
 		}
 		if ($this->_config['mode'] === 'ascii') {
@@ -300,7 +301,8 @@ class SluggedBehavior extends Behavior {
 			$field = $this->_table->alias() . '.' . $this->_config['field'];
 			$conditions = [$field => $slug];
 			$conditions = array_merge($conditions, $this->_config['scope']);
-			if ($id = $entity->get($this->_table->primaryKey())) {
+			$id = $entity->get($this->_table->primaryKey());
+			if ($id) {
 				$conditions['NOT'][$this->_table->alias() . '.' . $this->_table->primaryKey()] = $id;
 			}
 			$i = 0;

+ 4 - 2
src/Utility/L10n.php

@@ -278,7 +278,8 @@ class L10n {
 		if (is_array($mixed)) {
 			$result = [];
 			foreach ($mixed as $_mixed) {
-				if ($_result = $this->map($_mixed)) {
+				$_result = $this->map($_mixed);
+				if ($_result) {
 					$result[$_mixed] = $_result;
 				}
 			}
@@ -307,7 +308,8 @@ class L10n {
 		if (is_array($language)) {
 			$result = [];
 			foreach ($language as $_language) {
-				if ($_result = $this->catalog($_language)) {
+				$_result = $this->catalog($_language);
+				if ($_result) {
 					$result[$_language] = $_result;
 				}
 			}

+ 6 - 3
tests/TestCase/Mailer/EmailTest.php

@@ -177,7 +177,8 @@ class EmailTest extends TestCase {
 		$this->Email->to(Configure::read('Config.adminEmail'));
 		$this->Email->addAttachment($file);
 		$res = $this->Email->send('test_default', 'default');
-		if ($error = $this->Email->getError()) {
+		$error = $this->Email->getError();
+		if ($error) {
 			$this->out($error);
 		}
 		$this->assertEquals('', $this->Email->getError());
@@ -290,7 +291,8 @@ html-part
 
 		$res = $this->Email->send();
 		Configure::write('debug', 2);
-		if ($error = $this->Email->getError()) {
+		$error = $this->Email->getError();
+		if ($error) {
 			$this->out($error);
 		}
 		$this->assertEquals('', $this->Email->getError());
@@ -403,7 +405,8 @@ html-part
 
 		$res = $this->Email->send();
 
-		if ($error = $this->Email->getError()) {
+		$error = $this->Email->getError();
+		if ($error) {
 			$this->out($error);
 		}
 		$this->assertEquals('', $this->Email->getError());