浏览代码

simplify code

euromark 11 年之前
父节点
当前提交
39595e1df4
共有 2 个文件被更改,包括 4 次插入3 次删除
  1. 4 2
      Controller/Component/CommonComponent.php
  2. 0 1
      Test/Case/Model/Behavior/SluggedBehaviorTest.php

+ 4 - 2
Controller/Component/CommonComponent.php

@@ -127,10 +127,12 @@ class CommonComponent extends Component {
 	 * Convenience method to check on POSTED data.
 	 * Doesn't matter if it's POST or PUT.
 	 *
-	 * @return boolean isPost
+	 * Note that since 2.4 you can use request->is(array('post', 'put') directly.
+	 *
+	 * @return boolean If it is of type POST/PUT
 	 */
 	public function isPosted() {
-		return $this->Controller->request->is('post') || $this->Controller->request->is('put');
+		return $this->Controller->request->is(array('post', 'put'));
 	}
 
 	/**

+ 0 - 1
Test/Case/Model/Behavior/SluggedBehaviorTest.php

@@ -48,7 +48,6 @@ class SluggedBehaviorTest extends CakeTestCase {
 	 */
 	public function getTests() {
 		ini_set('memory_limit', '256M');
-		$memoryLimit = (int)ini_get('memory_limit');
 		$max = 0;
 		$classMethods = get_class_methods(get_class($this));
 		$counter = 0;