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

PhpWordHelper   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 4
c 1
b 0
f 0
dl 0
loc 21
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A mmToPoint() 0 3 1
A percentToPct() 0 3 1
A mmToTwip() 0 3 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