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

Utiles   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
eloc 3
dl 0
loc 19
rs 10
c 1
b 1
f 0
wmc 4

2 Methods

Rating   Name   Duplication   Size   Complexity  
A RTE() 0 3 2
A appendSlash() 0 3 2
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
}