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

ProcessResult::isSuccess()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
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