Completed
Push — master ( 091134...c0a386 )
by Tobias
04:29
created

Action::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1
1
<?php
2
3
/*
4
 * Copyright (C) 2013 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\Model\Route;
11
12
/**
13
 * @author David Garcia <[email protected]>
14
 */
15
final class Action
16
{
17
    /**
18
     * @var string
19
     */
20
    private $action;
21
22
    /**
23
     * Action Named Constructor to build several Action DTOs provided by an Array.
24
     *
25
     * @param array $data
26
     *
27
     * @return Action[]
28
     */
29 3
    public static function createMultiple(array $data)
30
    {
31 3
        $items = [];
32
33 3
        foreach ($data as $action) {
34 3
            $items[] = new self($action);
35 3
        }
36
37 3
        return $items;
38
    }
39
40
    /**
41
     * Action Private Constructor.
42
     *
43
     * @param $action
44
     */
45 3
    private function __construct($action)
46
    {
47 3
        $this->action = $action;
48 3
    }
49
50
    /**
51
     * @return string
52
     */
53
    public function getAction()
54
    {
55
        return $this->action;
56
    }
57
}
58