GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Formatters   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 0
cbo 0
dl 0
loc 37
ccs 6
cts 6
cp 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A format() 0 4 1
A round() 0 4 1
A truncate() 0 4 1
1
<?php
2
3
namespace WSW\Money\Support;
4
5
/**
6
 * Trait Formatters
7
 *
8
 * @package WSW\Money\Support
9
 * @author Ronaldo Matos Rodrigues <[email protected]>
10
 */
11
trait Formatters
12
{
13
    /**
14
     * @param string $amount
15
     * @param int $decimals
16
     * @param string $decPoint
17
     * @param string $thousandsSep
18
     *
19
     * @return string
20
     */
21 2
    protected function format($amount = "0.00", $decimals = 2, $decPoint = ',', $thousandsSep = '.')
22
    {
23 2
        return number_format($amount, $decimals, $decPoint, $thousandsSep);
24
    }
25
26
    /**
27
     * @param string $amount
28
     * @param int $decimals
29
     *
30
     * @return string
31
     */
32 1
    protected function round($amount = "0.00", $decimals = 2)
33
    {
34 1
        return sprintf('%0.'.$decimals.'f', $amount);
35
    }
36
37
    /**
38
     * @param string $amount
39
     * @param int $decimals
40
     *
41
     * @return string
42
     */
43 1
    protected function truncate($amount = "0.00", $decimals = 2)
44
    {
45 1
        return (string) substr($amount, 0, strpos($amount, '.') + 1 + $decimals);
46
    }
47
}
48