12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- <?php
-
- namespace Luticate\Utils;
-
- class LuMultipleDbo implements \JsonSerializable {
-
- /**
- * @var int
- */
- private $_count;
- public function setCount($count)
- {
- $this->_count = $count;
- }
- public function getCount()
- {
- return $this->_count;
- }
-
- /**
- * @var array
- */
- private $_data;
- public function setData($data)
- {
- $this->_data = $data;
- }
- public function getData()
- {
- return $this->_data;
- }
-
- function jsonSerialize()
- {
- return array(
- "Count" => $this->_count,
- "Data" => $this->_data
- );
- }
-
- function __construct($count = 0, $data = array())
- {
- $this->_count = $count;
- $this->_data = $data;
- }
-
- function map(callable $callback)
- {
- $values = [];
- foreach ($this->_data as $data) {
- $values[] = $callback($data);
- }
- return new LuMultipleDbo($this->_count, $values);
- }
- }
|