Passed
Pull Request — master (#172)
by
unknown
04:01
created

AmountSection   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 3
eloc 12
c 2
b 0
f 0
dl 0
loc 25
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getCurrencyCell() 0 3 1
A __construct() 0 10 1
A getAmountCell() 0 3 1
1
<?php
2
3
namespace Sprain\SwissQrBill\PaymentPart\Output\PhpWordOutput\Table\Receipt;
4
5
use PhpOffice\PhpWord\Element\Cell;
6
use PhpOffice\PhpWord\Style\Table;
7
use Sprain\SwissQrBill\PaymentPart\Output\PhpWordOutput\PhpWordHelper;
8
9
class AmountSection
10
{
11
    private Cell $currencyCell;
12
    private Cell $amountCell;
13
14
    public function __construct(Cell $cell, float $currencyWidth, float $amountWidth, float $height)
15
    {
16
        $table = $cell->addTable([
17
                'layout' => Table::LAYOUT_FIXED,
18
                'width' => PhpWordHelper::percentToPct(100),
19
                'unit' => 'pct',
20
        ]);
21
        $row = $table->addRow(PhpWordHelper::mmToTwip($height));
22
        $this->currencyCell = $row->addCell(PhpWordHelper::mmToTwip($currencyWidth));
23
        $this->amountCell = $row->addCell(PhpWordHelper::mmToTwip($amountWidth));
24
    }
25
26
    public function getCurrencyCell() : Cell
27
    {
28
        return $this->currencyCell;
29
    }
30
31
    public function getAmountCell() : Cell
32
    {
33
        return $this->amountCell;
34
    }
35
}
36