Test Failed
Pull Request — master (#172)
by
unknown
12:31
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));
0 ignored issues
show
Bug introduced by
Sprain\SwissQrBill\Payme...lper::mmToTwip($height) of type double is incompatible with the type integer expected by parameter $height of PhpOffice\PhpWord\Element\Table::addRow(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

21
        $row = $table->addRow(/** @scrutinizer ignore-type */ PhpWordHelper::mmToTwip($height));
Loading history...
22
        $this->currencyCell = $row->addCell(PhpWordHelper::mmToTwip($currencyWidth));
0 ignored issues
show
Bug introduced by
Sprain\SwissQrBill\Payme...mToTwip($currencyWidth) of type double is incompatible with the type integer expected by parameter $width of PhpOffice\PhpWord\Element\Row::addCell(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

22
        $this->currencyCell = $row->addCell(/** @scrutinizer ignore-type */ PhpWordHelper::mmToTwip($currencyWidth));
Loading history...
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