Subversion-Projekte lars-tiefland.laravel_shop

Revision

Revision 148 | Ganze Datei anzeigen | Leerzeichen ignorieren | Details | Blame | Letzte Änderung | Log anzeigen | RSS feed

Revision 148 Revision 399
Zeile 13... Zeile 13...
13
 *
13
 *
14
 * @psalm-immutable
14
 * @psalm-immutable
15
 */
15
 */
16
class BcMathCalculator extends Calculator
16
class BcMathCalculator extends Calculator
17
{
17
{
18
    /**
-
 
19
     * {@inheritdoc}
-
 
20
     */
-
 
21
    public function add(string $a, string $b) : string
18
    public function add(string $a, string $b) : string
22
    {
19
    {
23
        return \bcadd($a, $b, 0);
20
        return \bcadd($a, $b, 0);
24
    }
21
    }
Zeile 25... Zeile -...
25
 
-
 
26
    /**
-
 
27
     * {@inheritdoc}
-
 
28
     */
22
 
29
    public function sub(string $a, string $b) : string
23
    public function sub(string $a, string $b) : string
30
    {
24
    {
31
        return \bcsub($a, $b, 0);
25
        return \bcsub($a, $b, 0);
Zeile 32... Zeile -...
32
    }
-
 
33
 
-
 
34
    /**
-
 
35
     * {@inheritdoc}
26
    }
36
     */
27
 
37
    public function mul(string $a, string $b) : string
28
    public function mul(string $a, string $b) : string
38
    {
29
    {
Zeile 39... Zeile -...
39
        return \bcmul($a, $b, 0);
-
 
40
    }
-
 
41
 
-
 
42
    /**
-
 
43
     * {@inheritdoc}
-
 
44
     *
-
 
45
     * @psalm-suppress InvalidNullableReturnType
30
        return \bcmul($a, $b, 0);
46
     * @psalm-suppress NullableReturnStatement
31
    }
47
     */
32
 
48
    public function divQ(string $a, string $b) : string
33
    public function divQ(string $a, string $b) : string
Zeile 49... Zeile 34...
49
    {
34
    {
50
        return \bcdiv($a, $b, 0);
-
 
51
    }
-
 
52
 
35
        return \bcdiv($a, $b, 0);
53
    /**
36
    }
54
     * {@inheritdoc}
37
 
55
     *
38
    /**
56
     * @psalm-suppress InvalidNullableReturnType
39
     * @psalm-suppress InvalidNullableReturnType
57
     * @psalm-suppress NullableReturnStatement
-
 
58
     */
-
 
59
    public function divR(string $a, string $b) : string
-
 
60
    {
-
 
61
        if (version_compare(PHP_VERSION, '7.2') >= 0) {
40
     * @psalm-suppress NullableReturnStatement
62
            return \bcmod($a, $b, 0);
41
     */
Zeile 63... Zeile -...
63
        }
-
 
64
 
-
 
65
        return \bcmod($a, $b);
-
 
66
    }
42
    public function divR(string $a, string $b) : string
67
 
43
    {
68
    /**
44
        return \bcmod($a, $b, 0);
-
 
45
    }
Zeile 69... Zeile -...
69
     * {@inheritdoc}
-
 
70
     */
-
 
71
    public function divQR(string $a, string $b) : array
-
 
72
    {
-
 
73
        $q = \bcdiv($a, $b, 0);
-
 
74
 
-
 
75
        if (version_compare(PHP_VERSION, '7.2') >= 0) {
-
 
76
            $r = \bcmod($a, $b, 0);
46
 
Zeile 77... Zeile 47...
77
        } else {
47
    public function divQR(string $a, string $b) : array
78
            $r = \bcmod($a, $b);
48
    {
Zeile 79... Zeile -...
79
        }
-
 
80
 
-
 
81
        assert($q !== null);
-
 
82
        assert($r !== null);
49
        $q = \bcdiv($a, $b, 0);
83
 
50
        $r = \bcmod($a, $b, 0);
84
        return [$q, $r];
51
 
85
    }
52
        assert($r !== null);
Zeile 86... Zeile -...
86
 
-
 
87
    /**
-
 
88
     * {@inheritdoc}
-
 
89
     */
53
 
90
    public function pow(string $a, int $e) : string
54
        return [$q, $r];
91
    {
55
    }
92
        return \bcpow($a, (string) $e, 0);
56
 
Zeile 93... Zeile 57...
93
    }
57
    public function pow(string $a, int $e) : string
-
 
58
    {
94
 
59
        return \bcpow($a, (string) $e, 0);
95
    /**
60
    }
96
     * {@inheritdoc}
61
 
97
     */
62
    public function modPow(string $base, string $exp, string $mod) : string
98
    public function modPow(string $base, string $exp, string $mod) : string
63
    {
99
    {
64
        return \bcpowmod($base, $exp, $mod, 0);