summaryrefslogtreecommitdiffstats
path: root/library/SSRS/Object/CatalogItems.php
diff options
context:
space:
mode:
Diffstat (limited to 'library/SSRS/Object/CatalogItems.php')
-rwxr-xr-xlibrary/SSRS/Object/CatalogItems.php23
1 files changed, 20 insertions, 3 deletions
diff --git a/library/SSRS/Object/CatalogItems.php b/library/SSRS/Object/CatalogItems.php
index 6386cd5..22664f2 100755
--- a/library/SSRS/Object/CatalogItems.php
+++ b/library/SSRS/Object/CatalogItems.php
@@ -7,7 +7,7 @@ namespace SSRS\Object;
*
* @author arron
*/
-class CatalogItems extends ArrayIterator {
+class CatalogItems extends ArrayIterator implements \Countable {
public $iteratorKey = 'CatalogItems';
@@ -15,12 +15,29 @@ class CatalogItems extends ArrayIterator {
$this->data['CatalogItems'] = array();
}
+ public function count() {
+ return count($this->data['CatalogItems']);
+ }
+
+ /**
+ *
+ * @param \stdClass $items
+ * @return \SSRS\Object\CatalogItems
+ */
public function setCatalogItems(\stdClass $items) {
- foreach ($items->CatalogItem AS $item) {
- $this->addCatalogItem(new CatalogItem($item));
+ if (isset($items->CatalogItem)) {
+ foreach ($items->CatalogItem AS $item) {
+ $this->addCatalogItem(new CatalogItem($item));
+ }
}
+
+ return $this;
}
+ /**
+ *
+ * @param \SSRS\Object\CatalogItem $item
+ */
public function addCatalogItem(CatalogItem $item) {
$this->data['CatalogItems'][] = $item;
}