Test Failed
Pull Request — develop (#41)
by Yuji
05:06
created

UpdateOrderInfoRequest::setIsSeen()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 0
1
<?php
2
3
4
namespace Shippinno\YahooShoppingJp\Request;
5
6
7
use FluidXml\FluidXml;
8
use LogicException;
9
use Shippinno\YahooShoppingJp\Api\UpdateOrderInfoApi;
10
use Shippinno\YahooShoppingJp\Enum\PayKind;
11
use Shippinno\YahooShoppingJp\Enum\PayMethod;
12
use Shippinno\YahooShoppingJp\Enum\PayType;
13
use Shippinno\YahooShoppingJp\Enum\SuspectFlag;
14
use Shippinno\YahooShoppingJp\Response\UpdateOrderInfoResponse;
15
16
class UpdateOrderInfoRequest extends AbstractRequest
17
{
18
19
    /**
20
     * @return UpdateOrderInfoApi
21
     */
22
    public function api()
23
    {
24
        return new UpdateOrderInfoApi;
25
    }
26
27
    /**
28
     * @return UpdateOrderInfoResponse
29
     */
30
    public function response()
31
    {
32
        return new UpdateOrderInfoResponse;
33
    }
34
35
    /**
36
     * @return void
37
     */
38
    protected function validateParams()
39
    {
40
    }
41
42
    /**
43
     * @return string
44
     */
45
    public function getParams()
46
    {
47
        $this->setIsSeen();
48
        $this->validateParams();
49
50
        $fluidXml = new FluidXml('Req');
51
        $fluidXml->add($this->params);
52
53
        return $fluidXml->xml();
54
    }
55
56
    /**
57
     * [必須]注文ID
58
     *
59
     * @param string $orderId
60
     * @return UpdateOrderInfoRequest
61
     */
62 View Code Duplication
    public function setOrderId(string $orderId): self
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
63
    {
64
        if (isset($this->params['Target']['OrderId'])) {
65
            throw new LogicException('OrderId is already set.');
66
        }
67
        $this->params['Target']['OrderId'] = $orderId;
68
69
        return $this;
70
    }
71
72
    /**
73
     * [必須]ストアアカウント
74
     *
75
     * @param string $sellerId
76
     * @return UpdateOrderInfoRequest
77
     */
78 View Code Duplication
    public function setSellerId(string $sellerId): self
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
79
    {
80
        if (isset($this->params['SellerId'])) {
81
            throw new LogicException('SellerId is already set.');
82
        }
83
        $this->params['SellerId'] = $sellerId;
84
85
        return $this;
86
    }
87
88
    /**
89
     * 更新者名(ビジネスID登録氏名)
90
     * セラー更新のみ
91
     *
92
     * @param string $operationUser
93
     * @return UpdateOrderInfoRequest
94
     */
95 View Code Duplication
    public function setOperationUser(string $operationUser): self
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
96
    {
97
        if (isset($this->params['Target']['OperationUser'])) {
98
            throw new LogicException('OperationUser is already set.');
99
        }
100
        $this->params['Target']['OperationUser'] = $operationUser;
101
102
        return $this;
103
    }
104
105
    /**
106
     * 閲覧済みフラグ
107
     * 更新する時必ずtrue
108
     *
109
     * @return UpdateOrderInfoRequest
110
     */
111
    public function setIsSeen(): self
112
    {
113
        $this->params['Order']['IsSeen'] = true;
114
115
        return $this;
116
    }
117
118
    /**
119
     * 悪戯フラグ
120
     *
121
     * @param SuspectFlag $suspectFlag
122
     * @return UpdateOrderInfoRequest
123
     */
124 View Code Duplication
    public function setSuspect(SuspectFlag $suspectFlag): self
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
125
    {
126
        if (isset($this->params['Order']['Suspect'])) {
127
            throw new LogicException('Suspect is already set.');
128
        }
129
        $this->params['Order']['Suspect'] = $suspectFlag->getValue();
130
131
        return $this;
132
    }
133
134
    /**
135
     * 支払い分類
136
     *
137
     * @param PayType $payType
138
     * @return UpdateOrderInfoRequest
139
     */
140 View Code Duplication
    public function setPayType(PayType $payType): self
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
141
    {
142
        if (isset($this->params['Order']['PayType'])) {
143
            throw new LogicException('PayType is already set.');
144
        }
145
        $this->params['Order']['PayType'] = $payType->getValue();
146
147
        return $this;
148
    }
149
150
    /**
151
     * 支払い種別
152
     *
153
     * @param PayKind $payKind
154
     * @return UpdateOrderInfoRequest
155
     */
156 View Code Duplication
    public function setPayKind(PayKind $payKind): self
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
157
    {
158
        if (isset($this->params['Order']['PayKind'])) {
159
            throw new LogicException('PayKind is already set.');
160
        }
161
        $this->params['Order']['PayKind'] = $payKind->getValue();
162
163
        return $this;
164
    }
165
166
    /**
167
     * 支払い方法
168
     *
169
     * @param PayMethod $payMethod
170
     * @return UpdateOrderInfoRequest
171
     */
172 View Code Duplication
    public function setPayMethod(PayMethod $payMethod): self
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
173
    {
174
        if (isset($this->params['Order']['PayMethod'])) {
175
            throw new LogicException('PayMethod is already set.');
176
        }
177
        $this->params['Order']['PayMethod'] = $payMethod->getValue();
178
179
        return $this;
180
    }
181
182
    /**
183
     * 支払い方法名称
184
     * max:150byte
185
     *
186
     * @param string $payMethodName
187
     * @return UpdateOrderInfoRequest
188
     */
189 View Code Duplication
    public function setPayMethodName(string $payMethodName): self
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
190
    {
191
        if (isset($this->params['Order']['PayMethodName'])) {
192
            throw new LogicException('PayMethodName is already set.');
193
        }
194
        $this->params['Order']['PayMethodName'] = $payMethodName;
195
196
        return $this;
197
    }
198
199
    /**
200
     * ストアステータス
201
     * ストアが独自に設定可能なステータスです。
202
     * max:2byte
203
     *
204
     * @param string $storeStatus
205
     * @return UpdateOrderInfoRequest
206
     */
207 View Code Duplication
    public function setStoreStatus(string $storeStatus): self
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
208
    {
209
        if (isset($this->params['Order']['StoreStatus'])) {
210
            throw new LogicException('StoreStatus is already set.');
211
        }
212
        $this->params['Order']['StoreStatus'] = $storeStatus;
213
214
        return $this;
215
    }
216
217
    /**
218
     * 注文伝票出力時刻
219
     * 注文伝票を出力した日時です。
220
     * format:YYYYMMDDHH24MISS
221
     *
222
     * @param string $printSlipTime
223
     * @return UpdateOrderInfoRequest
224
     */
225 View Code Duplication
    public function setPrintSlipTime(\DateTimeImmutable $printSlipTime): self
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
226
    {
227
        if (isset($this->params['Order']['PrintSlipTime'])) {
228
            throw new LogicException('PrintSlipTime is already set.');
229
        }
230
        $this->params['Order']['PrintSlipTime'] = $printSlipTime->format('YmdHis');
231
232
        return $this;
233
    }
234
235
    /**
236
     * 納品書出力時刻
237
     * 納品書を出力した日時です。
238
     * format:YYYYMMDDHH24MISS
239
     *
240
     * @param \DateTimeImmutable $printDeliveryTime
241
     * @return UpdateOrderInfoRequest
242
     */
243 View Code Duplication
    public function setPrintDeliveryTime(\DateTimeImmutable $printDeliveryTime): self
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
244
    {
245
        if (isset($this->params['Order']['PrintDeliveryTime'])) {
246
            throw new LogicException('PrintDeliveryTime is already set.');
247
        }
248
        $this->params['Order']['PrintDeliveryTime'] = $printDeliveryTime->format('YmdHis');
249
250
        return $this;
251
    }
252
253
    /**
254
     * 請求書出力時刻
255
     * 請求書を出力した日時です。
256
     * format:YYYYMMDDHH24MISS
257
     *
258
     * @param \DateTimeImmutable $printBillTime
259
     * @return UpdateOrderInfoRequest
260
     */
261 View Code Duplication
    public function setPrintBillTime(\DateTimeImmutable $printBillTime): self
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
262
    {
263
        if (isset($this->params['Order']['PrintBillTime'])) {
264
            throw new LogicException('PrintBillTime is already set.');
265
        }
266
        $this->params['Order']['PrintBillTime'] = $printBillTime->format('YmdHis');
267
268
        return $this;
269
    }
270
271
    /**
272
     * バイヤーコメント
273
     * ご要望欄入力内容です。
274
     * max:750byte
275
     *
276
     * @param string $buyerComments
277
     * @return UpdateOrderInfoRequest
278
     */
279 View Code Duplication
    public function setBuyerComments(string $buyerComments): self
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
280
    {
281
        if (isset($this->params['Order']['BuyerComments'])) {
282
            throw new LogicException('BuyerComments is already set.');
283
        }
284
        $this->params['Order']['BuyerComments'] = $buyerComments;
285
286
        return $this;
287
    }
288
289
    /**
290
     * セラーコメント
291
     * セラーがカートに表示しているコメント文字列です。
292
     * max:750byte
293
     *
294
     * @param string $sellerComments
295
     * @return UpdateOrderInfoRequest
296
     */
297 View Code Duplication
    public function setSellerComments(string $sellerComments): self
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
298
    {
299
        if (isset($this->params['Order']['SellerComments'])) {
300
            throw new LogicException('SellerComments is already set.');
301
        }
302
        $this->params['Order']['SellerComments'] = $sellerComments;
303
304
        return $this;
305
    }
306
307
    /**
308
     * 社内メモ
309
     * ビジネス注文管理ツールでセラーが入力した社内メモです
310
     * max:未定
311
     *
312
     * @param string $notes
313
     * @return UpdateOrderInfoRequest
314
     */
315 View Code Duplication
    public function setNotes(string $notes): self
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
316
    {
317
        if (isset($this->params['Order']['Notes'])) {
318
            throw new LogicException('Notes is already set.');
319
        }
320
        $this->params['Order']['Notes'] = $notes;
321
322
        return $this;
323
    }
324
325
    /**
326
     * 社内メモ
327
     * ビジネス注文管理ツールでセラーが入力した社内メモです
328
     * 1byte(固定)
329
     *
330
     * @param string $refundStatus
331
     * @return UpdateOrderInfoRequest
332
     */
333 View Code Duplication
    public function setRefundStatus(string $refundStatus): self
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
334
    {
335
        if (isset($this->params['Order']['RefundStatus'])) {
336
            throw new LogicException('RefundStatus is already set.');
337
        }
338
        $this->params['Order']['RefundStatus'] = $refundStatus;
339
340
        return $this;
341
    }
342
343
}
344