mirror of
https://github.com/OpenXE-org/OpenXE.git
synced 2024-11-16 21:17:14 +01:00
40 lines
754 B
PHP
40 lines
754 B
PHP
|
<?php
|
||
|
|
||
|
namespace Xentral\Modules\Api\Dashboard;
|
||
|
|
||
|
use Xentral\Modules\Api\Resource\Result\AbstractResult;
|
||
|
|
||
|
final class WidgetResult extends AbstractResult
|
||
|
{
|
||
|
/**
|
||
|
* @param array $data
|
||
|
* @param array $pagination
|
||
|
*/
|
||
|
public function __construct(array $data, array $pagination = null)
|
||
|
{
|
||
|
$this->data = $data;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* @return array
|
||
|
*/
|
||
|
public function getData()
|
||
|
{
|
||
|
$data = [];
|
||
|
foreach ($this->data as $item) {
|
||
|
/** @var WidgetData $item */
|
||
|
$data[] = $item->toArray();
|
||
|
}
|
||
|
|
||
|
return $data;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* @param WidgetData $widgetData
|
||
|
*/
|
||
|
public function addData(WidgetData $widgetData)
|
||
|
{
|
||
|
$this->data[] = $widgetData;
|
||
|
}
|
||
|
}
|