Completed
Push — master ( 4a945d...f56bff )
by Andrii
02:24
created

Order   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 5
lcom 0
cbo 0
dl 0
loc 48
ccs 0
cts 22
cp 0
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A getId() 0 4 1
A getCustomer() 0 4 1
A getActions() 0 4 1
A jsonSerialize() 0 4 1
1
<?php
2
/**
3
 * PHP Billing Library
4
 *
5
 * @link      https://github.com/hiqdev/php-billing
6
 * @package   php-billing
7
 * @license   BSD-3-Clause
8
 * @copyright Copyright (c) 2017, HiQDev (http://hiqdev.com/)
9
 */
10
11
namespace hiqdev\php\billing\order;
12
13
use hiqdev\php\billing\customer\CustomerInterface;
14
15
/**
16
 * @author Andrii Vasyliev <[email protected]>
17
 */
18
class Order implements OrderInterface
19
{
20
    /**
21
     * @var int|string|null
22
     */
23
    protected $id;
24
25
    /**
26
     * @var CustomerInterface
27
     */
28
    protected $customer;
29
30
    /**
31
     * @var ActionInterface[] array: actionKey => action
32
     */
33
    protected $actions = [];
34
35
    public function __construct($id, CustomerInterface $customer, array $actions = [])
36
    {
37
        $this->id = $id;
38
        $this->customer = $customer;
39
        $this->actions = $actions;
40
    }
41
42
    public function getId()
43
    {
44
        return $this->id;
45
    }
46
47
    public function getCustomer()
48
    {
49
        return $this->customer;
50
    }
51
52
    /**
53
     * Returns actions.
54
     * @return ActionInterface[] array: actionKey => action
55
     */
56
    public function getActions()
57
    {
58
        return $this->actions;
59
    }
60
61
    public function jsonSerialize()
62
    {
63
        return get_object_vars($this);
64
    }
65
}
66