Code Duplication    Length = 39-44 lines in 5 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/Suppressions/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/Suppressions/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/Suppressions/Unsubscribe/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 Unsubscribe[]
25
     */
26
    private $items;
27
28
    /**
29
     * @param Unsubscribe[] $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
        $unsubscribes = [];
46
        if (isset($data['items'])) {
47
            foreach ($data['items'] as $item) {
48
                $unsubscribes[] = Unsubscribes::create($item);
49
            }
50
        }
51
52
        return new self($unsubscribes, $data['paging']);
53
    }
54
55
    /**
56
     * @return Unsubscribe[]
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