Completed
Pull Request — master (#249)
by David
18:43 queued 08:42
created

ActionDto::getAction()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
/*
4
 * Copyright (C) 2013-2016 Mailgun
5
 *
6
 * This software may be modified and distributed under the terms
7
 * of the MIT license. See the LICENSE file for details.
8
 */
9
10
namespace Mailgun\Resource\Api\Routes\Dto;
11
12
/**
13
 * @author David Garcia <[email protected]>
14
 */
15
final class ActionDto
16
{
17
    /**
18
     * @var string
19
     */
20
    private $action;
21
22
    /**
23
     * ActionDto Named Constructor to build several Action DTOs provided by an Array.
24
     *
25
     * @param array $data
26
     *
27
     * @return ActionDto[]
28
     */
29
    public static function createMultiple(array $data)
30
    {
31
        $items = [];
32
33
        foreach ($data as $action) {
34
            $items[] = new self($action);
35
        }
36
37
        return $items;
38
    }
39
40
    /**
41
     * ActionDto Private Constructor.
42
     *
43
     * @param $action
44
     */
45
    private function __construct($action)
46
    {
47
        $this->action = $action;
48
    }
49
50
    /**
51
     * @return string
52
     */
53
    public function getAction()
54
    {
55
        return $this->action;
56
    }
57
}
58