2019-01-06 08:11:37 +01:00
|
|
|
<?php
|
|
|
|
|
2019-01-09 20:32:09 +01:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
2019-01-06 08:11:37 +01:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2013 Mailgun
|
|
|
|
*
|
|
|
|
* This software may be modified and distributed under the terms
|
|
|
|
* of the MIT license. See the LICENSE file for details.
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace Mailgun\Model\MailingList;
|
|
|
|
|
|
|
|
use Mailgun\Model\PagingProvider;
|
|
|
|
use Mailgun\Model\PaginationResponse;
|
|
|
|
use Mailgun\Model\ApiResponse;
|
|
|
|
|
|
|
|
final class PagesResponse implements ApiResponse, PagingProvider
|
|
|
|
{
|
|
|
|
use PaginationResponse;
|
|
|
|
|
|
|
|
private $items;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return self
|
|
|
|
*/
|
|
|
|
public static function create(array $data)
|
|
|
|
{
|
|
|
|
$items = [];
|
|
|
|
|
|
|
|
if (isset($data['items'])) {
|
|
|
|
foreach ($data['items'] as $item) {
|
|
|
|
$items[] = MailingList::create($item);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-01-17 20:42:03 +01:00
|
|
|
$model = new self();
|
|
|
|
$model->items = $items;
|
|
|
|
$model->paging = $data['paging'];
|
|
|
|
|
|
|
|
return $model;
|
2019-01-06 08:11:37 +01:00
|
|
|
}
|
|
|
|
|
2019-01-17 20:42:03 +01:00
|
|
|
private function __construct()
|
2019-01-06 08:11:37 +01:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return MailingList[]
|
|
|
|
*/
|
2019-01-17 20:42:03 +01:00
|
|
|
public function getLists(): array
|
2019-01-06 08:11:37 +01:00
|
|
|
{
|
|
|
|
return $this->items;
|
|
|
|
}
|
|
|
|
}
|