MathUtils::smartRound()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
cc 1
eloc 1
c 1
b 1
f 0
nc 1
nop 2
dl 0
loc 3
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Rico\Lib;
6
7
use Rico\Slib\MathUtils as StaticMathUtils;
8
9
class MathUtils
10
{
11
    /**
12
     * Rounds a $number adding decimal part only when int part of $number < $idealLength.
13
     *
14
     * @param float $number
15
     * @param int   $idealLength
16
     *
17
     * @return float
18
     */
19
    public function smartRound(float $number, int $idealLength = 3): float
20
    {
21
        return StaticMathUtils::smartRound($number, $idealLength);
22
    }
23
}
24