Test Failed
Pull Request — master (#172)
by
unknown
12:31
created

PhpWordHelper::percentToPct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
c 0
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 1
1
<?php
2
3
namespace Sprain\SwissQrBill\PaymentPart\Output\PhpWordOutput;
4
5
use PhpOffice\PhpWord\Shared\Converter;
6
7
abstract class PhpWordHelper
8
{
9
    public static function mmToTwip(int|float $mm) : float|int
10
    {
11
        return Converter::cmToTwip($mm / 10);
12
    }
13
14
    public static function mmToPoint(int|float $mm) : float|int
15
    {
16
        return Converter::cmToPoint($mm / 10);
17
    }
18
19
    /**
20
     * Convert percentage to fiftieths (1/50) of a percent (1% = 50 unit).
21
     *
22
     * @param int|float $percent
23
     * @return int|float
24
     */
25
    public static function percentToPct(int|float $percent) : int|float
26
    {
27
        return $percent * 50;
28
    }
29
}
30