Code Duplication    Length = 39-45 lines in 6 locations

src/Mailgun/Model/Event/EventResponse.php 1 location

@@ 19-57 (lines=39) @@
16
/**
17
 * @author Tobias Nyholm <[email protected]>
18
 */
19
class EventResponse implements ApiResponse, PagingProvider
20
{
21
    use PaginationResponse;
22
23
    /**
24
     * @var Event[]
25
     */
26
    private $items;
27
28
    /**
29
     * @param Event[] $items
30
     * @param array   $paging
31
     */
32
    public function __construct(array $items, array $paging)
33
    {
34
        $this->items = $items;
35
        $this->paging = $paging;
36
    }
37
38
    public static function create(array $data)
39
    {
40
        $events = [];
41
        if (isset($data['items'])) {
42
            foreach ($data['items'] as $item) {
43
                $events[] = Event::create($item);
44
            }
45
        }
46
47
        return new self($events, $data['paging']);
48
    }
49
50
    /**
51
     * @return Event[]
52
     */
53
    public function getItems()
54
    {
55
        return $this->items;
56
    }
57
}
58

src/Mailgun/Model/Suppression/Bounce/IndexResponse.php 1 location

@@ 19-62 (lines=44) @@
16
/**
17
 * @author Sean Johnson <[email protected]>
18
 */
19
final class IndexResponse implements ApiResponse, PagingProvider
20
{
21
    use PaginationResponse;
22
23
    /**
24
     * @var Bounce[]
25
     */
26
    private $items;
27
28
    /**
29
     * @param Bounce[] $items
30
     * @param array    $paging
31
     */
32
    private function __construct(array $items, array $paging)
33
    {
34
        $this->items = $items;
35
        $this->paging = $paging;
36
    }
37
38
    /**
39
     * @param array $data
40
     *
41
     * @return IndexResponse
42
     */
43
    public static function create(array $data)
44
    {
45
        $bounces = [];
46
        if (isset($data['items'])) {
47
            foreach ($data['items'] as $item) {
48
                $bounces[] = Bounce::create($item);
49
            }
50
        }
51
52
        return new self($bounces, $data['paging']);
53
    }
54
55
    /**
56
     * @return Bounce[]
57
     */
58
    public function getItems()
59
    {
60
        return $this->items;
61
    }
62
}
63

src/Mailgun/Model/Suppression/Complaint/IndexResponse.php 1 location

@@ 19-62 (lines=44) @@
16
/**
17
 * @author Sean Johnson <[email protected]>
18
 */
19
final class IndexResponse implements ApiResponse, PagingProvider
20
{
21
    use PaginationResponse;
22
23
    /**
24
     * @var Complaint[]
25
     */
26
    private $items;
27
28
    /**
29
     * @param Complaint[] $items
30
     * @param array       $paging
31
     */
32
    private function __construct(array $items, array $paging)
33
    {
34
        $this->items = $items;
35
        $this->paging = $paging;
36
    }
37
38
    /**
39
     * @param array $data
40
     *
41
     * @return IndexResponse
42
     */
43
    public static function create(array $data)
44
    {
45
        $complaints = [];
46
        if (isset($data['items'])) {
47
            foreach ($data['items'] as $item) {
48
                $complaints[] = Complaint::create($item);
49
            }
50
        }
51
52
        return new self($complaints, $data['paging']);
53
    }
54
55
    /**
56
     * @return Complaint[]
57
     */
58
    public function getItems()
59
    {
60
        return $this->items;
61
    }
62
}
63

src/Mailgun/Model/Tag/IndexResponse.php 1 location

@@ 19-60 (lines=42) @@
16
/**
17
 * @author Tobias Nyholm <[email protected]>
18
 */
19
final class IndexResponse implements ApiResponse, PagingProvider
20
{
21
    use PaginationResponse;
22
23
    /**
24
     * @var Tag[]
25
     */
26
    private $items;
27
28
    /**
29
     * @param Tag[] $items
30
     * @param array $paging
31
     */
32
    public function __construct(array $items, array $paging)
33
    {
34
        $this->items = $items;
35
        $this->paging = $paging;
36
    }
37
38
    /**
39
     * @param array $data
40
     *
41
     * @return IndexResponse
42
     */
43
    public static function create(array $data)
44
    {
45
        $items = [];
46
        foreach ($data['items'] as $item) {
47
            $items[] = Tag::create($item);
48
        }
49
50
        return new self($items, $data['paging']);
51
    }
52
53
    /**
54
     * @return Tag[]
55
     */
56
    public function getItems()
57
    {
58
        return $this->items;
59
    }
60
}
61

src/Mailgun/Model/MailingList/Member/IndexResponse.php 1 location

@@ 16-60 (lines=45) @@
13
use Mailgun\Model\PaginationResponse;
14
use Mailgun\Model\ApiResponse;
15
16
final class IndexResponse implements ApiResponse, PagingProvider
17
{
18
    use PaginationResponse;
19
20
    /**
21
     * @var Member[]
22
     */
23
    private $items;
24
25
    /**
26
     * @param array $data
27
     *
28
     * @return self
29
     */
30
    public static function create(array $data)
31
    {
32
        $items = [];
33
34
        if (isset($data['items'])) {
35
            foreach ($data['items'] as $item) {
36
                $items[] = Member::create($item);
37
            }
38
        }
39
40
        return new self($items, $data['paging']);
41
    }
42
43
    /**
44
     * @param Member[] $items
45
     * @param array    $paging
46
     */
47
    private function __construct(array $items, array $paging)
48
    {
49
        $this->items = $items;
50
        $this->paging = $paging;
51
    }
52
53
    /**
54
     * @return Member[]
55
     */
56
    public function getItems()
57
    {
58
        return $this->items;
59
    }
60
}
61

src/Mailgun/Model/MailingList/PagesResponse.php 1 location

@@ 16-60 (lines=45) @@
13
use Mailgun\Model\PaginationResponse;
14
use Mailgun\Model\ApiResponse;
15
16
final class PagesResponse implements ApiResponse, PagingProvider
17
{
18
    use PaginationResponse;
19
20
    /**
21
     * @var MailingList[]
22
     */
23
    private $items;
24
25
    /**
26
     * @param array $data
27
     *
28
     * @return self
29
     */
30
    public static function create(array $data)
31
    {
32
        $items = [];
33
34
        if (isset($data['items'])) {
35
            foreach ($data['items'] as $item) {
36
                $items[] = MailingList::create($item);
37
            }
38
        }
39
40
        return new self($items, $data['paging']);
41
    }
42
43
    /**
44
     * @param MailingList[] $items
45
     * @param array         $paging
46
     */
47
    private function __construct(array $items, array $paging)
48
    {
49
        $this->items = $items;
50
        $this->paging = $paging;
51
    }
52
53
    /**
54
     * @return MailingList[]
55
     */
56
    public function getLists()
57
    {
58
        return $this->items;
59
    }
60
}
61