Test Failed
Pull Request — develop (#41)
by Yuji
03:43
created

UpdateOrderInfoRequest::setPrintBillTime()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 5

Duplication

Lines 9
Ratio 100 %

Importance

Changes 0
Metric Value
dl 9
loc 9
rs 9.6666
c 0
b 0
f 0
cc 2
eloc 5
nc 2
nop 1
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\RefundStatus;
14
use Shippinno\YahooShoppingJp\Enum\SuspectFlag;
15
use Shippinno\YahooShoppingJp\Response\UpdateOrderInfoResponse;
16
17
class UpdateOrderInfoRequest extends AbstractRequest
18
{
19
20
    /**
21
     * @return UpdateOrderInfoApi
22
     */
23
    public function api()
24
    {
25
        return new UpdateOrderInfoApi;
26
    }
27
28
    /**
29
     * @return UpdateOrderInfoResponse
30
     */
31
    public function response()
32
    {
33
        return new UpdateOrderInfoResponse;
34
    }
35
36
    /**
37
     * @return void
38
     */
39
    protected function validateParams()
40
    {
41
    }
42
43
    /**
44
     * @return string
45
     */
46
    public function getParams()
47
    {
48
        $this->setIsSeen();
49
        $this->validateParams();
50
51
        $fluidXml = new FluidXml('Req');
52
        $fluidXml->add($this->params);
53
54
        return $fluidXml->xml();
55
    }
56
57
    /**
58
     * [必須]注文ID
59
     *
60
     * @param string $orderId
61
     * @return UpdateOrderInfoRequest
62
     */
63 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...
64
    {
65
        if (isset($this->params['Target']['OrderId'])) {
66
            throw new LogicException('OrderId is already set.');
67
        }
68
        $this->params['Target']['OrderId'] = $orderId;
69
70
        return $this;
71
    }
72
73
    /**
74
     * [必須]ストアアカウント
75
     *
76
     * @param string $sellerId
77
     * @return UpdateOrderInfoRequest
78
     */
79 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...
80
    {
81
        if (isset($this->params['SellerId'])) {
82
            throw new LogicException('SellerId is already set.');
83
        }
84
        $this->params['SellerId'] = $sellerId;
85
86
        return $this;
87
    }
88
89
    /**
90
     * 更新者名(ビジネスID登録氏名)
91
     * セラー更新のみ
92
     *
93
     * @param string $operationUser
94
     * @return UpdateOrderInfoRequest
95
     */
96 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...
97
    {
98
        if (isset($this->params['Target']['OperationUser'])) {
99
            throw new LogicException('OperationUser is already set.');
100
        }
101
        $this->params['Target']['OperationUser'] = $operationUser;
102
103
        return $this;
104
    }
105
106
    /**
107
     * 閲覧済みフラグ
108
     * 更新する時必ずtrue
109
     *
110
     * @return UpdateOrderInfoRequest
111
     */
112
    public function setIsSeen(): self
113
    {
114
        $this->params['Order']['IsSeen'] = true;
115
116
        return $this;
117
    }
118
119
    /**
120
     * 悪戯フラグ
121
     *
122
     * @param SuspectFlag $suspectFlag
123
     * @return UpdateOrderInfoRequest
124
     */
125 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...
126
    {
127
        if (isset($this->params['Order']['Suspect'])) {
128
            throw new LogicException('Suspect is already set.');
129
        }
130
        $this->params['Order']['Suspect'] = $suspectFlag->getValue();
131
132
        return $this;
133
    }
134
135
    /**
136
     * 支払い分類
137
     *
138
     * @param PayType $payType
139
     * @return UpdateOrderInfoRequest
140
     */
141 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...
142
    {
143
        if (isset($this->params['Order']['PayType'])) {
144
            throw new LogicException('PayType is already set.');
145
        }
146
        $this->params['Order']['PayType'] = $payType->getValue();
147
148
        return $this;
149
    }
150
151
    /**
152
     * 支払い種別
153
     *
154
     * @param PayKind $payKind
155
     * @return UpdateOrderInfoRequest
156
     */
157 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...
158
    {
159
        if (isset($this->params['Order']['PayKind'])) {
160
            throw new LogicException('PayKind is already set.');
161
        }
162
        $this->params['Order']['PayKind'] = $payKind->getValue();
163
164
        return $this;
165
    }
166
167
    /**
168
     * 支払い方法
169
     *
170
     * @param PayMethod $payMethod
171
     * @return UpdateOrderInfoRequest
172
     */
173 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...
174
    {
175
        if (isset($this->params['Order']['PayMethod'])) {
176
            throw new LogicException('PayMethod is already set.');
177
        }
178
        $this->params['Order']['PayMethod'] = $payMethod->getValue();
179
180
        return $this;
181
    }
182
183
    /**
184
     * 支払い方法名称
185
     * max:150byte
186
     *
187
     * @param string $payMethodName
188
     * @return UpdateOrderInfoRequest
189
     */
190 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...
191
    {
192
        if (isset($this->params['Order']['PayMethodName'])) {
193
            throw new LogicException('PayMethodName is already set.');
194
        }
195
        $this->params['Order']['PayMethodName'] = $payMethodName;
196
197
        return $this;
198
    }
199
200
    /**
201
     * ストアステータス
202
     * ストアが独自に設定可能なステータスです。
203
     * max:2byte
204
     *
205
     * @param string $storeStatus
206
     * @return UpdateOrderInfoRequest
207
     */
208 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...
209
    {
210
        if (isset($this->params['Order']['StoreStatus'])) {
211
            throw new LogicException('StoreStatus is already set.');
212
        }
213
        $this->params['Order']['StoreStatus'] = $storeStatus;
214
215
        return $this;
216
    }
217
218
    /**
219
     * 注文伝票出力時刻
220
     * 注文伝票を出力した日時です。
221
     * format:YYYYMMDDHH24MISS
222
     *
223
     * @param string $printSlipTime
224
     * @return UpdateOrderInfoRequest
225
     */
226 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...
227
    {
228
        if (isset($this->params['Order']['PrintSlipTime'])) {
229
            throw new LogicException('PrintSlipTime is already set.');
230
        }
231
        $this->params['Order']['PrintSlipTime'] = $printSlipTime->format('YmdHis');
232
233
        return $this;
234
    }
235
236
    /**
237
     * 納品書出力時刻
238
     * 納品書を出力した日時です。
239
     * format:YYYYMMDDHH24MISS
240
     *
241
     * @param \DateTimeImmutable $printDeliveryTime
242
     * @return UpdateOrderInfoRequest
243
     */
244 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...
245
    {
246
        if (isset($this->params['Order']['PrintDeliveryTime'])) {
247
            throw new LogicException('PrintDeliveryTime is already set.');
248
        }
249
        $this->params['Order']['PrintDeliveryTime'] = $printDeliveryTime->format('YmdHis');
250
251
        return $this;
252
    }
253
254
    /**
255
     * 請求書出力時刻
256
     * 請求書を出力した日時です。
257
     * format:YYYYMMDDHH24MISS
258
     *
259
     * @param \DateTimeImmutable $printBillTime
260
     * @return UpdateOrderInfoRequest
261
     */
262 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...
263
    {
264
        if (isset($this->params['Order']['PrintBillTime'])) {
265
            throw new LogicException('PrintBillTime is already set.');
266
        }
267
        $this->params['Order']['PrintBillTime'] = $printBillTime->format('YmdHis');
268
269
        return $this;
270
    }
271
272
    /**
273
     * バイヤーコメント
274
     * ご要望欄入力内容です。
275
     * max:750byte
276
     *
277
     * @param string $buyerComments
278
     * @return UpdateOrderInfoRequest
279
     */
280 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...
281
    {
282
        if (isset($this->params['Order']['BuyerComments'])) {
283
            throw new LogicException('BuyerComments is already set.');
284
        }
285
        $this->params['Order']['BuyerComments'] = $buyerComments;
286
287
        return $this;
288
    }
289
290
    /**
291
     * セラーコメント
292
     * セラーがカートに表示しているコメント文字列です。
293
     * max:750byte
294
     *
295
     * @param string $sellerComments
296
     * @return UpdateOrderInfoRequest
297
     */
298 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...
299
    {
300
        if (isset($this->params['Order']['SellerComments'])) {
301
            throw new LogicException('SellerComments is already set.');
302
        }
303
        $this->params['Order']['SellerComments'] = $sellerComments;
304
305
        return $this;
306
    }
307
308
    /**
309
     * 社内メモ
310
     * ビジネス注文管理ツールでセラーが入力した社内メモです
311
     * max:未定
312
     *
313
     * @param string $notes
314
     * @return UpdateOrderInfoRequest
315
     */
316 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...
317
    {
318
        if (isset($this->params['Order']['Notes'])) {
319
            throw new LogicException('Notes is already set.');
320
        }
321
        $this->params['Order']['Notes'] = $notes;
322
323
        return $this;
324
    }
325
326
    /**
327
     * 返金ステータス
328
     * APIで更新できるのは1:必要から2:返金済みへの更新のみ。
329
     *
330
     * @param RefundStatus $refundStatus
331
     * @return UpdateOrderInfoRequest
332
     */
333 View Code Duplication
    public function setRefundStatus(RefundStatus $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->getValue();
339
340
        return $this;
341
    }
342
343
344
    /**
345
     * @param \DateTimeImmutable $printBillTime
0 ignored issues
show
Bug introduced by
There is no parameter named $printBillTime. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
346
     * @return UpdateOrderInfoRequest
347
     */
348 View Code Duplication
    public function setPayDate(\DateTimeImmutable $payDate): 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...
349
    {
350
        if (isset($this->params['Order']['PayDate'])) {
351
            throw new LogicException('PayDate is already set.');
352
        }
353
        $this->params['Order']['PayDate'] = $payDate->format('YmdHis');
354
355
        return $this;
356
    }
357
}
358