Skip to content

Commit 2f6a8e7

Browse files
committed
Makes returned data iterable
1 parent fbeaa29 commit 2f6a8e7

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/SensorValue/SensorValueCollection.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@
22

33
namespace Moay\OpensensemapApiClient\SensorValue;
44

5+
use Traversable;
6+
57
/**
68
* Class DataCollection.
79
*/
8-
class SensorValueCollection implements \JsonSerializable, \Countable
10+
class SensorValueCollection implements \JsonSerializable, \Countable, \IteratorAggregate
911
{
1012
/** @var SensorValue[] */
1113
private $sensorValues;
@@ -44,5 +46,13 @@ public function count()
4446
return count($this->sensorValues);
4547
}
4648

49+
/**
50+
* @return \ArrayIterator|Traversable
51+
*/
52+
public function getIterator()
53+
{
54+
return new \ArrayIterator($this->sensorValues);
55+
}
56+
4757

4858
}

0 commit comments

Comments
 (0)