Completed
Pull Request — master (#249)
by David
25:09 queued 15:31
created

ActionDto   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 0
dl 0
loc 43
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A createMultiple() 0 10 2
A __construct() 0 4 1
A getAction() 0 4 1
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