Browse Source

Fix coding standards errors.

Also remove count() calls in TreeBehavior.
mark_story 14 years ago
parent
commit
55c4ad3c1c

+ 4 - 2
lib/Cake/Model/Behavior/TreeBehavior.php

@@ -377,10 +377,12 @@ class TreeBehavior extends ModelBehavior {
 		$stack = array();
 
 		foreach ($results as $i => $result) {
-			while ($stack && ($stack[count($stack) - 1] < $result[$Model->alias][$right])) {
+			$count = count($stack);
+			while ($stack && ($stack[$count - 1] < $result[$Model->alias][$right])) {
 				array_pop($stack);
+				$count--;
 			}
-			$results[$i]['tree_prefix'] = str_repeat($spacer, count($stack));
+			$results[$i]['tree_prefix'] = str_repeat($spacer, $count);
 			$stack[] = $result[$Model->alias][$right];
 		}
 		if (empty($results)) {

+ 1 - 1
lib/Cake/Test/Case/View/XmlViewTest.php

@@ -119,7 +119,7 @@ class XmlViewTest extends CakeTestCase {
 		$output = $View->render('index');
 
 		$expected = array(
-			'users'=> array('user'=> array('user1', 'user2'))
+			'users' => array('user' => array('user1', 'user2'))
 		);
 		$expected = Xml::build($expected)->asXML();
 		$this->assertSame($expected, $output);