Passed
Push — master ( 4d4fc5...4bc7af )
by Amin
03:11
created

Utiles::RTE()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
cc 2
eloc 1
nc 2
nop 1
dl 0
loc 3
rs 10
c 1
b 1
f 0
1
<?php
2
3
/**
4
 * This file is part of the ******* package.
5
 *
6
 * (c) Amin Yazdanpanah <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
13
namespace Streaming;
14
15
16
class Utiles
17
{
18
    /**
19
     * @param string $str
20
     * @return string
21
     */
22
    public static function appendSlash(string $str): string
23
    {
24
        return $str ? rtrim($str, '/') . "/" : $str;
25
    }
26
27
    /**
28
     * Round to even number
29
     * @param float $num
30
     * @return int
31
     */
32
    public static function RTE(float $num): int
33
    {
34
        return (int)$num % 2 == 0 ? $num : ++$num;
0 ignored issues
show
Bug Best Practice introduced by
The expression return (int)$num % 2 == 0 ? $num : ++$num could return the type double which is incompatible with the type-hinted return integer. Consider adding an additional type-check to rule them out.
Loading history...
35
    }
36
}