Permalink
Browse files

XmlView: renamed _rootElement to _rootNode

Local variable in _serialize renamed as well.
  • Loading branch information...
1 parent d623d9e commit 1ab8f98fdce07bb49c4129c263e519ebbfdad014 @larryb82 committed Nov 2, 2012
Showing with 6 additions and 6 deletions.
  1. +2 −2 lib/Cake/Test/Case/View/XmlViewTest.php
  2. +4 −4 lib/Cake/View/XmlView.php
@@ -66,7 +66,7 @@ public function testRenderWithoutView() {
$this->assertSame($expected, $output);
- $Controller->set('_rootElement', 'custom_name');
+ $Controller->set('_rootNode', 'custom_name');
$View = new XmlView($Controller);
$output = $View->render(false);
@@ -95,7 +95,7 @@ public function testRenderWithoutViewMultiple() {
$this->assertSame(Xml::build($expected)->asXML(), $output);
- $Controller->set('_rootElement', 'custom_name');
+ $Controller->set('_rootNode', 'custom_name');
$View = new XmlView($Controller);
$output = $View->render(false);
$expected = array(
@@ -99,17 +99,17 @@ public function render($view = null, $layout = null) {
* @return string The serialized data
*/
protected function _serialize($serialize) {
- $root = isset($this->viewVars['_rootElement']) ? $this->viewVars['_rootElement'] : 'response';
+ $rootNode = isset($this->viewVars['_rootNode']) ? $this->viewVars['_rootNode'] : 'response';
if (is_array($serialize)) {
- $data = array($root => array());
+ $data = array($rootNode => array());
foreach ($serialize as $key) {
- $data[$root][$key] = $this->viewVars[$key];
+ $data[$rootNode][$key] = $this->viewVars[$key];
}
} else {
$data = isset($this->viewVars[$serialize]) ? $this->viewVars[$serialize] : null;
if (is_array($data) && Set::numeric(array_keys($data))) {
- $data = array($root => array($serialize => $data));
+ $data = array($rootNode => array($serialize => $data));
}
}
return Xml::fromArray($data)->asXML();

0 comments on commit 1ab8f98

Please sign in to comment.