Permalink
Browse files

Fix coding standards errors.

Also remove count() calls in TreeBehavior.
  • Loading branch information...
1 parent 085ad0b commit 55c4ad3c1c6523a2aa97316dd03d8a359fa9df66 @markstory markstory committed Jun 1, 2012
Showing with 5 additions and 3 deletions.
  1. +4 −2 lib/Cake/Model/Behavior/TreeBehavior.php
  2. +1 −1 lib/Cake/Test/Case/View/XmlViewTest.php
@@ -377,10 +377,12 @@ public function generateTreeList(Model $Model, $conditions = null, $keyPath = nu
$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)) {
@@ -119,7 +119,7 @@ public function testRenderWithView() {
$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);

0 comments on commit 55c4ad3

Please sign in to comment.