Code Coverage
 
Classes and Traits
Functions and Methods
Lines
Total
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
2 / 2
CRAP
100.00% covered (success)
100.00%
4 / 4
PercentCalculator
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
2 / 2
3
100.00% covered (success)
100.00%
4 / 4
 __construct
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
3 / 3
 calculatePercent
100.00% covered (success)
100.00%
1 / 1
2
100.00% covered (success)
100.00%
1 / 1
1<?php
2class PercentCalculator
3{
4    public function __construct(int $numerator, int $denominator)
5    {
6        $this->numerator = $numerator;
7        $this->denominator = $denominator;
8    }
9
10    public function calculatePercent(): float
11    {
12        return $this->denominator ? round($this->numerator / $this->denominator * 100, 1) : 0.0;
13    }
14}