Completed
Pull Request — master (#22)
by Manuel
04:59
created

Placeholder::getHeight()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Sprain\SwissQrBill\PaymentPart\Output\Element;
4
5
class Placeholder implements OutputElementInterface
6
{
7
    const PLACEHOLDER_TYPE_PAYABLE_BY = [
8
        'type' => 'placeholder_payable_by',
9
        'file' => __DIR__ . '/../../../../assets/marks_65x25mm.svg',
10
        'width' => 65,
11
        'height' => 25
12
    ];
13
14
    const PLACEHOLDER_TYPE_PAYABLE_BY_RECEIPT = [
15
        'type' => 'placeholder_payable_by_receipt',
16
        'file' => __DIR__ . '/../../../../assets/marks_52x20mm.svg',
17
        'width' => 52,
18
        'height' => 20
19
    ];
20
21
    const PLACEHOLDER_TYPE_AMOUNT = [
22
        'type' => 'placeholder_amount',
23
        'file' => __DIR__ . '/../../../../assets/marks_40x15mm.svg',
24
        'width' => 40,
25
        'height' => 15
26
    ];
27
28
    const PLACEHOLDER_TYPE_AMOUNT_RECEIPT = [
29
        'type' => 'placeholder_amount_receipt',
30
        'file' => __DIR__ . '/../../../../assets/marks_30x10mm.svg',
31
        'width' => 30,
32
        'height' => 10
33
    ];
34
35
    /** @var string */
36
    private $type;
37
38
    /** @var string */
39
    private $file;
40
41
    /** @var int */
42
    private $width;
43
44
    /** @var int */
45
    private $height;
46
47
    public static function create(array $type): self
48
    {
49
        $placeholder = new self();
50
        $placeholder->type = $type['type'];
51
        $placeholder->file = $type['file'];
52
        $placeholder->width = $type['width'];
53
        $placeholder->height = $type['height'];
54
55
        return $placeholder;
56
    }
57
58
    public function getType(): ?string
59
    {
60
        return $this->type;
61
    }
62
63
    public function getFile(): ?string
64
    {
65
        return $this->file;
66
    }
67
68
    public function getWidth(): ?int
69
    {
70
        return $this->width;
71
    }
72
73
    public function getHeight(): ?int
74
    {
75
        return $this->height;
76
    }
77
}