Failed Conditions
Pull Request — experimental/sf (#3236)
by Kentaro
144:19 queued 116:23
created

Payment::getCreator()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 4
ccs 0
cts 2
cp 0
crap 2
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\Entity;
15
16
use Doctrine\ORM\Mapping as ORM;
17
18
/**
19
 * Payment
20
 *
21
 * @ORM\Table(name="dtb_payment")
22
 * @ORM\InheritanceType("SINGLE_TABLE")
23
 * @ORM\DiscriminatorColumn(name="discriminator_type", type="string", length=255)
24
 * @ORM\HasLifecycleCallbacks()
25
 * @ORM\Entity(repositoryClass="Eccube\Repository\PaymentRepository")
26
 */
27
class Payment extends \Eccube\Entity\AbstractEntity
28
{
29
    /**
30
     * @return string
31
     */
32 5
    public function __toString()
33
    {
34 5
        return (string) $this->getMethod();
35
    }
36
37
    /**
38
     * @var int
39
     *
40
     * @ORM\Column(name="id", type="integer", options={"unsigned":true})
41
     * @ORM\Id
42
     * @ORM\GeneratedValue(strategy="IDENTITY")
43
     */
44
    private $id;
45
46
    /**
47
     * @var string|null
48
     *
49
     * @ORM\Column(name="payment_method", type="string", length=255, nullable=true)
50
     */
51
    private $method;
52
53
    /**
54
     * @var string|null
55
     *
56
     * @ORM\Column(name="charge", type="decimal", precision=12, scale=2, nullable=true, options={"unsigned":true,"default":0})
57
     */
58
    private $charge = 0;
59
60
    /**
61
     * @var string|null
62
     *
63
     * @ORM\Column(name="rule_max", type="decimal", precision=12, scale=2, nullable=true, options={"unsigned":true})
64
     */
65
    private $rule_max;
66
67
    /**
68
     * @var int|null
69
     *
70
     * @ORM\Column(name="sort_no", type="smallint", nullable=true, options={"unsigned":true})
71
     */
72
    private $sort_no;
73
74
    /**
75
     * @var boolean
76
     *
77
     * @ORM\Column(name="fixed", type="boolean", options={"default":true})
78
     */
79
    private $fixed = true;
80
81
    /**
82
     * @var string|null
83
     *
84
     * @ORM\Column(name="payment_image", type="string", length=255, nullable=true)
85
     */
86
    private $payment_image;
87
88
    /**
89
     * @var string|null
90
     *
91
     * @ORM\Column(name="rule_min", type="decimal", precision=12, scale=2, nullable=true, options={"unsigned":true})
92
     */
93
    private $rule_min;
94
95
    /**
96
     * @var string|null
97
     *
98
     * @ORM\Column(name="method_class", type="string", length=255, nullable=true)
99
     */
100
    private $method_class;
101
102
    /**
103
     * @var int
104
     *
105
     * @ORM\Column(name="visible", type="boolean", options={"default":true})
106
     */
107
    private $visible;
108
109
    /**
110
     * @var \DateTime
111
     *
112
     * @ORM\Column(name="create_date", type="datetimetz")
113
     */
114
    private $create_date;
115
116
    /**
117
     * @var \DateTime
118
     *
119
     * @ORM\Column(name="update_date", type="datetimetz")
120
     */
121
    private $update_date;
122
123
    /**
124
     * @var \Doctrine\Common\Collections\Collection
125
     *
126
     * @ORM\OneToMany(targetEntity="Eccube\Entity\PaymentOption", mappedBy="Payment")
127
     */
128
    private $PaymentOptions;
129
130
    /**
131
     * @var \Eccube\Entity\Member
132
     *
133
     * @ORM\ManyToOne(targetEntity="Eccube\Entity\Member")
134
     * @ORM\JoinColumns({
135
     *   @ORM\JoinColumn(name="creator_id", referencedColumnName="id")
136
     * })
137
     */
138
    private $Creator;
139
140
    /**
141
     * Constructor
142
     */
143 25
    public function __construct()
144
    {
145 25
        $this->PaymentOptions = new \Doctrine\Common\Collections\ArrayCollection();
146
    }
147
148
    /**
149
     * Get id.
150
     *
151
     * @return int
152
     */
153 225
    public function getId()
154
    {
155 225
        return $this->id;
156
    }
157
158
    /**
159
     * Set method.
160
     *
161
     * @param string|null $method
162
     *
163
     * @return Payment
164
     */
165 20
    public function setMethod($method = null)
166
    {
167 20
        $this->method = $method;
168
169 20
        return $this;
170
    }
171
172
    /**
173
     * Get method.
174
     *
175
     * @return string|null
176
     */
177 251
    public function getMethod()
178
    {
179 251
        return $this->method;
180
    }
181
182
    /**
183
     * Set charge.
184
     *
185
     * @param string|null $charge
186
     *
187
     * @return Payment
188
     */
189 15
    public function setCharge($charge = null)
190
    {
191 15
        $this->charge = $charge;
192
193 15
        return $this;
194
    }
195
196
    /**
197
     * Get charge.
198
     *
199
     * @return string|null
200
     */
201 17
    public function getCharge()
202
    {
203 17
        return $this->charge;
204
    }
205
206
    /**
207
     * Set ruleMax.
208
     *
209
     * @param string|null $ruleMax
210
     *
211
     * @return Payment
212
     */
213 15
    public function setRuleMax($ruleMax = null)
214
    {
215 15
        $this->rule_max = $ruleMax;
216
217 15
        return $this;
218
    }
219
220
    /**
221
     * Get ruleMax.
222
     *
223
     * @return string|null
224
     */
225 17
    public function getRuleMax()
226
    {
227 17
        return $this->rule_max;
228
    }
229
230
    /**
231
     * Set sortNo.
232
     *
233
     * @param int|null $sortNo
234
     *
235
     * @return Payment
236
     */
237 12
    public function setSortNo($sortNo = null)
238
    {
239 12
        $this->sort_no = $sortNo;
240
241 12
        return $this;
242
    }
243
244
    /**
245
     * Get sortNo.
246
     *
247
     * @return int|null
248
     */
249 12
    public function getSortNo()
250
    {
251 12
        return $this->sort_no;
252
    }
253
254
    /**
255
     * Set fixed.
256
     *
257
     * @param boolean $fixed
258
     *
259
     * @return Payment
260
     */
261 21
    public function setFixed($fixed)
262
    {
263 21
        $this->fixed = $fixed;
264
265 21
        return $this;
266
    }
267
268
    /**
269
     * Get fixed.
270
     *
271
     * @return boolean
272
     */
273 17
    public function isFixed()
274
    {
275 17
        return $this->fixed;
276
    }
277
278
    /**
279
     * Set paymentImage.
280
     *
281
     * @param string|null $paymentImage
282
     *
283
     * @return Payment
284
     */
285 4
    public function setPaymentImage($paymentImage = null)
286
    {
287 4
        $this->payment_image = $paymentImage;
288
289 4
        return $this;
290
    }
291
292
    /**
293
     * Get paymentImage.
294
     *
295
     * @return string|null
296
     */
297 62
    public function getPaymentImage()
298
    {
299 62
        return $this->payment_image;
300
    }
301
302
    /**
303
     * Set ruleMin.
304
     *
305
     * @param string|null $ruleMin
306
     *
307
     * @return Payment
308
     */
309 15
    public function setRuleMin($ruleMin = null)
310
    {
311 15
        $this->rule_min = $ruleMin;
312
313 15
        return $this;
314
    }
315
316
    /**
317
     * Get ruleMin.
318
     *
319
     * @return string|null
320
     */
321 17
    public function getRuleMin()
322
    {
323 17
        return $this->rule_min;
324
    }
325
326
    /**
327
     * Set methodClass.
328
     *
329
     * @param string|null $methodClass
330
     *
331
     * @return Payment
332
     */
333 1
    public function setMethodClass($methodClass = null)
334
    {
335 1
        $this->method_class = $methodClass;
336
337 1
        return $this;
338
    }
339
340
    /**
341
     * Get methodClass.
342
     *
343
     * @return string|null
344
     */
345 8
    public function getMethodClass()
346
    {
347 8
        return $this->method_class;
348
    }
349
350
    /**
351
     * @return integer
352
     */
353 18
    public function isVisible()
354
    {
355 18
        return $this->visible;
356
    }
357
358
    /**
359
     * @param boolean $visible
360
     *
361
     * @return Payment
362
     */
363 14
    public function setVisible($visible)
364
    {
365 14
        $this->visible = $visible;
0 ignored issues
show
Documentation Bug introduced by
The property $visible was declared of type integer, but $visible is of type boolean. Maybe add a type cast?

This check looks for assignments to scalar types that may be of the wrong type.

To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.

$answer = 42;

$correct = false;

$correct = (bool) $answer;
Loading history...
366
367 14
        return $this;
368
    }
369
370
    /**
371
     * Set createDate.
372
     *
373
     * @param \DateTime $createDate
374
     *
375
     * @return Payment
376
     */
377 12
    public function setCreateDate($createDate)
378
    {
379 12
        $this->create_date = $createDate;
380
381 12
        return $this;
382
    }
383
384
    /**
385
     * Get createDate.
386
     *
387
     * @return \DateTime
388
     */
389
    public function getCreateDate()
390
    {
391
        return $this->create_date;
392
    }
393
394
    /**
395
     * Set updateDate.
396
     *
397
     * @param \DateTime $updateDate
398
     *
399
     * @return Payment
400
     */
401 16
    public function setUpdateDate($updateDate)
402
    {
403 16
        $this->update_date = $updateDate;
404
405 16
        return $this;
406
    }
407
408
    /**
409
     * Get updateDate.
410
     *
411
     * @return \DateTime
412
     */
413
    public function getUpdateDate()
414
    {
415
        return $this->update_date;
416
    }
417
418
    /**
419
     * Add paymentOption.
420
     *
421
     * @param \Eccube\Entity\PaymentOption $paymentOption
422
     *
423
     * @return Payment
424
     */
425 157
    public function addPaymentOption(\Eccube\Entity\PaymentOption $paymentOption)
426
    {
427 157
        $this->PaymentOptions[] = $paymentOption;
428
429 157
        return $this;
430
    }
431
432
    /**
433
     * Remove paymentOption.
434
     *
435
     * @param \Eccube\Entity\PaymentOption $paymentOption
436
     *
437
     * @return boolean TRUE if this collection contained the specified element, FALSE otherwise.
438
     */
439
    public function removePaymentOption(\Eccube\Entity\PaymentOption $paymentOption)
440
    {
441
        return $this->PaymentOptions->removeElement($paymentOption);
442
    }
443
444
    /**
445
     * Get paymentOptions.
446
     *
447
     * @return \Doctrine\Common\Collections\Collection
448
     */
449
    public function getPaymentOptions()
450
    {
451
        return $this->PaymentOptions;
452
    }
453
454
    /**
455
     * Set creator.
456
     *
457
     * @param \Eccube\Entity\Member|null $creator
458
     *
459
     * @return Payment
460
     */
461 6
    public function setCreator(\Eccube\Entity\Member $creator = null)
462
    {
463 6
        $this->Creator = $creator;
464
465 6
        return $this;
466
    }
467
468
    /**
469
     * Get creator.
470
     *
471
     * @return \Eccube\Entity\Member|null
472
     */
473
    public function getCreator()
474
    {
475
        return $this->Creator;
476
    }
477
478
    /**
479
     * @return string
480
     */
481 1
    public function getMethodForAdmin()
482
    {
483 1
        if ($this->isVisible()) {
484 1
            return $this->getMethod();
485
        }
486
487
        return $this->getMethod().'(非表示)';
488
    }
489
}
490