PackageDimension   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 53
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 0
dl 0
loc 53
ccs 0
cts 25
cp 0
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A createFromArray() 0 10 1
A getHeight() 0 4 1
A getLength() 0 4 1
A getWeight() 0 4 1
A getWidth() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
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 Shapin\Stripe\Model\Product;
11
12
use Shapin\Stripe\Model\CreatableFromArray;
13
14
final class PackageDimension implements CreatableFromArray
15
{
16
    /**
17
     * @var float
18
     */
19
    private $height;
20
21
    /**
22
     * @var float
23
     */
24
    private $length;
25
26
    /**
27
     * @var float
28
     */
29
    private $weight;
30
31
    /**
32
     * @var float
33
     */
34
    private $width;
35
36
    public static function createFromArray(array $data): self
37
    {
38
        $model = new self();
39
        $model->height = (float) $data['height'];
40
        $model->length = (float) $data['length'];
41
        $model->weight = (float) $data['weight'];
42
        $model->width = (float) $data['width'];
43
44
        return $model;
45
    }
46
47
    public function getHeight(): float
48
    {
49
        return $this->height;
50
    }
51
52
    public function getLength(): float
53
    {
54
        return $this->length;
55
    }
56
57
    public function getWeight(): float
58
    {
59
        return $this->weight;
60
    }
61
62
    public function getWidth(): float
63
    {
64
        return $this->width;
65
    }
66
}
67