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.

TextUtils   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 27.78%
Metric Value
wmc 7
lcom 0
cbo 0
dl 0
loc 37
ccs 5
cts 18
cp 0.2778
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
C parseBoolean() 0 30 7
1
<?php
2
/**
3
 * @link https://github.com/old-town/old-town-workflow
4
 * @author  Malofeykin Andrey  <[email protected]>
5
 */
6
namespace OldTown\Workflow\Util;
7
8
/**
9
 * Class TextUtil
10
 * @package OldTown\Workflow\Util
11
 */
12
class  TextUtils
13
{
14
    /**
15
     * @param $in
16
     * @return bool|string
17
     */
18 11
    public static function parseBoolean($in)
19
    {
20 11
        $value = $in;
21 11
        if (!is_string($value)) {
22 11
            if (!settype($value, 'boolean')) {
23
                return false;
24
            }
25 11
            return $value;
26
        }
27
28
        $value = trim($value);
29
        if (0 === count($value)) {
30
            return false;
31
        }
32
33
        $firstSymbol = substr($value, 0, 1);
34
        $firstSymbol = strtolower($firstSymbol);
35
36
        switch ($firstSymbol) {
37
            case '1':
38
            case 't':
39
            case 'y': {
40
                return true;
41
            }
42
            default: {
43
                return false;
44
            }
45
46
        }
47
    }
48
}
49