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.
Passed
Push — 3.0 ( 665678...02fb2f )
by Vermeulen
02:18
created

BasicCliMsg   A

Complexity

Total Complexity 10

Size/Duplication

Total Lines 55
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 25
dl 0
loc 55
rs 10
c 0
b 0
f 0
wmc 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A displayMsgInCli() 0 17 2
A displayMsgNLInCli() 0 12 2
A obtainShellTxtStyleCode() 0 7 2
A obtainShellTxtColorCode() 0 11 4
1
<?php
2
3
namespace BFW\Traits;
4
5
trait BasicCliMsg
6
{
7
    protected function displayMsgInCli(
8
        string $msg,
9
        string $txtColor='white',
0 ignored issues
show
Coding Style introduced by
Incorrect spacing between argument "$txtColor" and equals sign; expected 1 but found 0
Loading history...
Coding Style introduced by
Incorrect spacing between default value and equals sign for argument "$txtColor"; expected 1 but found 0
Loading history...
10
        string $txtStyle='normal'
0 ignored issues
show
Coding Style introduced by
Incorrect spacing between argument "$txtStyle" and equals sign; expected 1 but found 0
Loading history...
Coding Style introduced by
Incorrect spacing between default value and equals sign for argument "$txtStyle"; expected 1 but found 0
Loading history...
11
    ) {
12
        $nbArgs = func_num_args();
13
        if ($nbArgs === 1) {
14
            echo $msg;
15
            ob_flush();
16
            return;
17
        }
18
        
19
        $txtStyleCode = $this->obtainShellTxtStyleCode($txtStyle);
20
        $txtColorCode = $this->obtainShellTxtColorCode($txtColor);
21
        
22
        echo "\033[".$txtStyleCode.";".$txtColorCode."m".$msg."\033[0m";
23
        ob_flush();
24
    }
25
    
26
    protected function displayMsgNLInCli(
27
        string $msg,
28
        string $txtColor='white',
0 ignored issues
show
Coding Style introduced by
Incorrect spacing between argument "$txtColor" and equals sign; expected 1 but found 0
Loading history...
Coding Style introduced by
Incorrect spacing between default value and equals sign for argument "$txtColor"; expected 1 but found 0
Loading history...
29
        string $txtStyle='normal'
0 ignored issues
show
Coding Style introduced by
Incorrect spacing between argument "$txtStyle" and equals sign; expected 1 but found 0
Loading history...
Coding Style introduced by
Incorrect spacing between default value and equals sign for argument "$txtStyle"; expected 1 but found 0
Loading history...
30
    ) {
31
        $nbArgs = func_num_args();
32
        if ($nbArgs === 1) {
33
            $this->displayMsgInCli($msg."\n");
34
            return;
35
        }
36
        
37
        $this->displayMsgInCli($msg."\n", $txtColor, $txtStyle);
38
    }
39
    
40
    protected function obtainShellTxtColorCode(string $txtColor): int
41
    {
42
        if ($txtColor === 'red') {
43
            return 31;
44
        } elseif ($txtColor === 'green') {
45
            return 32;
46
        } elseif ($txtColor === 'yellow') {
47
            return 33;
48
        }
49
        
50
        return 37; //white
51
    }
52
    
53
    protected function obtainShellTxtStyleCode(string $txtStyle): int
54
    {
55
        if ($txtStyle === 'bold') {
56
            return 1;
57
        }
58
        
59
        return 0; //normal
60
    }
61
}
62