summaryrefslogtreecommitdiffstats
path: root/src/datasets
diff options
context:
space:
mode:
authorKore Nordmann <github@kore-nordmann.de>2007-01-03 12:48:08 +0000
committerKore Nordmann <github@kore-nordmann.de>2007-01-03 12:48:08 +0000
commit0024eea585da209c8dd6e286f634d3d41d6034a3 (patch)
tree3b60b92f31defa94473846984fd11086452bc724 /src/datasets
parent7090a42cd106646837dde004fd8e67810c003329 (diff)
downloadzetacomponents-graph-0024eea585da209c8dd6e286f634d3d41d6034a3.zip
zetacomponents-graph-0024eea585da209c8dd6e286f634d3d41d6034a3.tar.gz
- Fixed issue #9916: ArrayDataSet can handle Iterator was not documented
- Added and test additional typecheck
Diffstat (limited to 'src/datasets')
-rw-r--r--src/datasets/array.php15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/datasets/array.php b/src/datasets/array.php
index e28a761..00951cb 100644
--- a/src/datasets/array.php
+++ b/src/datasets/array.php
@@ -18,9 +18,8 @@ class ezcGraphArrayDataSet extends ezcGraphDataSet
/**
* Constructor
*
- * @param array $options Default option array
+ * @param mixed $options Array or Iterator containing the data
* @return void
- * @ignore
*/
public function __construct( $data )
{
@@ -29,14 +28,22 @@ class ezcGraphArrayDataSet extends ezcGraphDataSet
}
/**
- * setData
+ * setData
+ *
+ * Can handle data provided through an array or iterator.
*
- * @param array $data
+ * @param mixed $data
* @access public
* @return void
*/
protected function createFromArray( $data = array() )
{
+ if ( !is_array( $data ) &&
+ !( $data instanceof Iterator ) )
+ {
+ throw new ezcGraphInvalidArrayDataSourceException( $data );
+ }
+
foreach ( $data as $key => $value )
{
$this->data[$key] = $value;
OpenPOWER on IntegriCloud