HelperFunctions   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 24
ccs 7
cts 7
cp 1
rs 10
wmc 4

2 Methods

Rating   Name   Duplication   Size   Complexity  
A java_get_session_lifetime() 0 5 2
A java_truncate() 0 7 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Soluble\Japha\Bridge\Driver\Pjb62\Utils;
6
7
/**
8
 * @author Vanvelthem Sébastien
9
 */
10
class HelperFunctions
11
{
12
    /**
13
     * @return int
14
     */
15 2
    public static function java_get_session_lifetime(): int
16
    {
17 2
        $session_max_lifetime = ini_get('session.gc_maxlifetime');
18
19 2
        return $session_max_lifetime ? (int) $session_max_lifetime : 1440;
20
    }
21
22
    /**
23
     * @param string $str
24
     *
25
     * @return string
26
     */
27 1
    public static function java_truncate(string $str): string
28
    {
29 1
        if (strlen($str) > 955) {
30 1
            return substr($str, 0, 475).'[...]'.substr($str, -475);
31
        }
32
33 1
        return $str;
34
    }
35
}
36