Package::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 6
ccs 5
cts 5
cp 1
rs 9.4285
cc 1
eloc 4
nc 1
nop 3
crap 1
1
<?php
2
3
namespace Jne;
4
5
use Jne\Contracts\Foundation\WeightInterface;
6
use Jne\Contracts\Foundation\PackageInterface;
7
use Jne\Contracts\Foundation\LocationInterface;
8
9
class Package implements PackageInterface
10
{
11
    /**
12
     * Package's origin.
13
     *
14
     * @var \Jne\Contracts\Foundation\LocationInterface
15
     */
16
    protected $origin;
17
18
    /**
19
     * Package's destination.
20
     *
21
     * @var \Jne\Contracts\Foundation\LocationInterface
22
     */
23
    protected $destination;
24
25
    /**
26
     * Package's weight.
27
     *
28
     * @var \Jne\Contracts\Foundation\WeightInterface
29
     */
30
    protected $weight;
31
32
    /**
33
     * Create a new instance of Package.
34
     *
35
     * @param \Jne\Contracts\Foundation\LocationInterface $origin
36
     * @param \Jne\Contracts\Foundation\LocationInterface $destination
37
     * @param \Jne\Contracts\Foundation\WeightInterface   $weight
38
     */
39 4
    public function __construct(LocationInterface $origin, LocationInterface $destination, WeightInterface $weight)
40
    {
41 4
        $this->origin = $origin;
42 4
        $this->destination = $destination;
43 4
        $this->weight = $weight;
44 4
    }
45
46
    /**
47
     * Get package's origin.
48
     *
49
     * @return \Jne\Contracts\Foundation\LocationInterface
50
     */
51 2
    public function origin()
52
    {
53 2
        return $this->origin;
54
    }
55
56
    /**
57
     * Get package's destination.
58
     *
59
     * @return \Jne\Contracts\Foundation\LocationInterface
60
     */
61 2
    public function destination()
62
    {
63 2
        return $this->destination;
64
    }
65
66
    /**
67
     * Get package's weight.
68
     *
69
     * @return \Jne\Contracts\Foundation\WeightInterface
70
     */
71 2
    public function weight()
72
    {
73 2
        return $this->weight;
74
    }
75
}
76