Failed Conditions
Pull Request — experimental/sf (#3240)
by Kentaro
43:45
created

PaymentResult::setSuccess()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 1
dl 0
loc 6
ccs 3
cts 3
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
/*
4
 * This file is part of EC-CUBE
5
 *
6
 * Copyright(c) LOCKON CO.,LTD. All Rights Reserved.
7
 *
8
 * http://www.lockon.co.jp/
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace Eccube\Service\Payment;
15
16
use Symfony\Component\HttpFoundation\Response;
17
18
/**
19
 * 決済結果のクラス.
20
 */
21
class PaymentResult
22
{
23
    /**
24
     * @var array
25
     */
26
    private $errors;
27
28
    /**
29
     * @var boolean
30
     */
31
    private $success;
32
33
    /**
34
     * @var Response
35
     */
36
    private $response;
37
38
    /**
39
     * 決済が成功したかどうかを設定します.
40
     *
41
     * 決済が成功した場合は true, 失敗した場合は false を設定します.
42
     *
43
     * @param boolean $success
44
     *
45
     * @return PaymentResult
46
     */
47 7
    public function setSuccess($success)
48
    {
49 7
        $this->success = $success;
50
51 7
        return $this;
52
    }
53
54
    /**
55
     * 決済が成功したかどうか.
56
     *
57
     * 決済が成功した場合 true
58
     *
59
     * @return boolean
60
     */
61 7
    public function isSuccess()
62
    {
63 7
        return $this->success;
64
    }
65
66
    /**
67
     * 決済が失敗した場合のエラーの配列を返します.
68
     *
69
     * @return array
70
     */
71
    public function getErrors()
72
    {
73
        return [];
74
    }
75
76
    /**
77
     * 決済が失敗した場合のエラーの配列を設定します.
78
     *
79
     * @param array $errors
80
     *
81
     * @return PaymentResult
82
     */
83
    public function setErrors(array $errors)
84
    {
85
        $this->errors = $errors;
86
87
        return $this;
88
    }
89
90
    /**
91
     * Response を設定します.
92
     *
93
     * 3Dセキュアなど, 決済中に他のサイトへリダイレクトが必要な特殊な用途に使用します.
94
     *
95
     * @param Response $response
96
     *
97
     * @return PaymentResult
98
     */
99
    public function setResponse(Response $response)
100
    {
101
        $this->response = $response;
102
103
        return $this;
104
    }
105
106
    /**
107
     * Response を返します.
108
     *
109
     * @return Response
110
     */
111 6
    public function getResponse()
112
    {
113 6
        return $this->response;
114
    }
115
}
116