• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

h4kuna / number-format / 7139179860

08 Dec 2023 08:38AM UTC coverage: 98.141% (-0.3%) from 98.425%
7139179860

push

github

h4kuna
feat(Percentage)!: Tax renamed Vat, Percent renamed Sale

39 of 40 new or added lines in 3 files covered. (97.5%)

264 of 269 relevant lines covered (98.14%)

0.98 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

92.31
/src/Number/Sale.php
1
<?php declare(strict_types=1);
2

3
namespace h4kuna\Format\Number;
4

5
/**
6
 * properties will become readonly
7
 */
8
final class Sale
9
{
10
        public float $ratio;
11

12
        public float $smallRatio;
13

14

15
        public function __construct(public float $percent)
1✔
16
        {
17
                $this->smallRatio = Percentage::smallRatio($this->percent);
1✔
18
                $this->ratio = Percentage::ratio($this->smallRatio);
1✔
19
        }
1✔
20

21

22
        public function with(float $number): float
1✔
23
        {
24
                return Percentage::with($this->ratio, $number);
1✔
25
        }
26

27

28
        public function deduct(float $number): float
1✔
29
        {
30
                return Percentage::deduct($this->percent, $number);
1✔
31
        }
32

33

34
        public function diffWith(float $number): float
1✔
35
        {
36
                return Percentage::diffWith($this->ratio, $number);
1✔
37
        }
38

39

40
        public function diff(float $number): float
1✔
41
        {
42
                return Percentage::diffDeduct($this->percent, $number);
1✔
43
        }
44

45

46
        public function __toString()
47
        {
NEW
48
                return (string) $this->percent;
×
49
        }
50

51
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc