Permalink
Browse files

Init SerializableResponseStream with one or more SerializableResponse…

…Chunk(s)
  • Loading branch information...
1 parent 26b2499 commit f70d3aae31a0502de8ca49c616e0eef3e901b4c6 @cdujeu cdujeu committed Jun 2, 2016
@@ -139,31 +139,7 @@ public static function renderPaginationData($count, $currentPage, $totalPages, $
$string = '<pagination count="'.$count.'" total="'.$totalPages.'" current="'.$currentPage.'" overflowMessage="'.$currentPage."/".$totalPages.'" icon="folder.png" openicon="folder_open.png" dirsCount="'.$dirsCount.'"'.$remoteSortString.'/>';
return XMLWriter::write($string, $print);
}
-
- /**
- * Convert an arbitrary list of data (array of associative array) as standard XML list.
- * @param $data
- * @param $rootPath
- * @param $idKey
- * @param $labelKey
- */
- public static function renderSimpleListAsNodes($data, $rootPath, $idKey, $labelKey){
-
- self::header();
-
- foreach($data as $item){
-
- $nodeName = rtrim($rootPath, "/")."/".$item[$idKey];
- $nodeLabel = $item[$labelKey];
- $isLeaf = true;
- $metaData = $item;
- self::renderNode($nodeName, $nodeLabel, $isLeaf, $metaData);
-
- }
-
- self::close();
- }
-
+
/**
* Prints out the XML headers and preamble, then an open node
* @static
@@ -44,8 +44,15 @@ class SerializableResponseStream implements StreamInterface
private $streamStatus = 'open';
+ /**
+ * SerializableResponseStream constructor.
+ * @param SerializableResponseChunk[]|SerializableResponseChunk $chunks
+ */
public function __construct($chunks = [])
{
+ if(is_object($chunks) && $chunks instanceof SerializableResponseChunk){
+ $chunks = [$chunks];
+ }
if(count($chunks)){
$this->data = $chunks;
}

0 comments on commit f70d3aa

Please sign in to comment.