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.

NumberMethods::padding()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
ccs 1
cts 1
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 3
crap 1
1
<?php
2
declare(strict_types=1);
3
4
/*
5
 * This file is part of Underscore.php
6
 *
7
 * (c) Maxime Fabre <[email protected]>
8
 *
9
 * For the full copyright and license information, please view the LICENSE
10
 * file that was distributed with this source code.
11
 */
12
13
namespace Underscore\Methods;
14
15
/**
16
 * Methods to manage numbers.
17
 */
18
class NumberMethods
19
{
20
21
    /**
22
     * Add 0 padding to an integer.
23
     *
24
     * @param     $number
25
     *
26
     */
27
    public static function padding(mixed $number, int $padding = 1, int $direction = STR_PAD_BOTH) : string
28
    {
29 5
        return str_pad((string) $number, $padding, '0', $direction);
30
    }
31 5
32
    /**
33
     * Add 0 padding on the left of an integer.
34
     *
35
     * @param     $number
36
     *
37
     */
38
    public static function paddingLeft($number, int $padding = 1) : string
39
    {
40
        return static::padding($number, $padding, STR_PAD_LEFT);
41
    }
42 2
43
    /**
44 2
     * Add 0 padding on the right of an integer.
45
     *
46
     * @param     $number
47
     *
48
     */
49
    public static function paddingRight($number, int $padding = 1) : string
50
    {
51
        return static::padding($number, $padding, STR_PAD_RIGHT);
52
    }
53
}
54