Failed Conditions
Pull Request — experimental/3.1 (#2486)
by
unknown
68:04 queued 25:47
created

ProcessResult   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 1

Test Coverage

Coverage 88.24%

Importance

Changes 0
Metric Value
dl 0
loc 50
ccs 15
cts 17
cp 0.8824
rs 10
c 0
b 0
f 0
wmc 8
lcom 2
cbo 1

8 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A warn() 0 4 1
A error() 0 4 1
A success() 0 4 1
A isError() 0 4 1
A isWarning() 0 4 1
A isSuccess() 0 4 1
A getMessage() 0 4 1
1
<?php
2
3
namespace Eccube\Service\PurchaseFlow;
4
5
use Eccube\Application;
6
7
class ProcessResult
0 ignored issues
show
introduced by
Missing class doc comment
Loading history...
8
{
9
    const ERROR = 'ERROR';
10
    const WARNING = 'WARNING';
11
    const SUCCESS = 'SUCCESS';
12
13
    protected $type;
14
    protected $message;
15
16 49
    private function __construct($type, $message = null, $messageArgs)
0 ignored issues
show
Coding Style introduced by
Parameters which have default values should be placed at the end.

If you place a parameter with a default value before a parameter with a default value, the default value of the first parameter will never be used as it will always need to be passed anyway:

// $a must always be passed; it's default value is never used.
function someFunction($a = 5, $b) { }
Loading history...
17
    {
18 49
        $this->type = $type;
19 49
        $this->message = Application::getInstance()->trans($message, $messageArgs);
20
    }
21
22 10
    public static function warn($message, $messageArgs = [])
0 ignored issues
show
introduced by
Missing function doc comment
Loading history...
23
    {
24 10
        return new self(self::WARNING, $message, $messageArgs);
25
    }
26
27 4
    public static function error($message, $messageArgs = [])
0 ignored issues
show
introduced by
Missing function doc comment
Loading history...
28
    {
29 4
        return new self(self::ERROR, $message, $messageArgs);
30
    }
31
32 35
    public static function success()
0 ignored issues
show
introduced by
Missing function doc comment
Loading history...
33
    {
34 35
        return new self(self::SUCCESS, null, []);
35
    }
36
37 28
    public function isError()
0 ignored issues
show
introduced by
Missing function doc comment
Loading history...
38
    {
39 28
        return $this->type === self::ERROR;
40
    }
41
42 18
    public function isWarning()
0 ignored issues
show
introduced by
Missing function doc comment
Loading history...
43
    {
44 18
        return $this->type === self::WARNING;
45
    }
46
47 2
    public function isSuccess()
0 ignored issues
show
introduced by
Missing function doc comment
Loading history...
48
    {
49 2
        return $this->type === self::SUCCESS;
50
    }
51
52
    public function getMessage()
0 ignored issues
show
introduced by
Missing function doc comment
Loading history...
53
    {
54
        return $this->message;
55
    }
56
}
57