Passed
Push — master ( f4feef...3322ef )
by payever
10:36
created

AbstractPaymentOptionEntity::setTranslations()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 1
1
<?php
2
3
/**
4
 * PHP version 5.4 and 7
5
 *
6
 * @category  MessageEntity
7
 * @package   Payever\Payments
8
 * @author    payever GmbH <[email protected]>
9
 * @copyright 2017-2021 payever GmbH
10
 * @license   MIT <https://opensource.org/licenses/MIT>
11
 * @link      https://docs.payever.org/shopsystems/api/getting-started
12
 */
13
14
namespace Payever\ExternalIntegration\Payments\Http\MessageEntity;
15
16
use Payever\ExternalIntegration\Core\Http\MessageEntity\ResultEntity;
17
18
/**
19
 * This class represents List Payment Options Result Entity
20
 *
21
 * @method string                           getId()
22
 * @method string                           getName()
23
 * @method bool                             getStatus()
24
 * @method float                            getVariableFee()
25
 * @method float                            getFixedFee()
26
 * @method string                           getDescriptionOffer()
27
 * @method string                           getDescriptionFee()
28
 * @method float                            getMin()
29
 * @method float                            getMax()
30
 * @method string                           getPaymentMethod()
31
 * @method string                           getType()
32
 * @method string                           getSlug()
33
 * @method string                           getThumbnail1()
34
 * @method string                           getThumbnail2()
35
 * @method string                           getThumbnail3()
36
 * @method PaymentOptionOptionsEntity       getOptions()
37
 * @method PaymentOptionTranslationEntity[] getTranslations()
38
 * @method self                             setId()
39
 * @method self                             setName()
40
 * @method self                             setVariableFee()
41
 * @method self                             setIsRedirectMethod()
42
 * @method self                             setFixedFee()
43
 * @method self                             setDescriptionOffer()
44
 * @method self                             setDescriptionFee()
45
 * @method self                             setMin()
46
 * @method self                             setMax()
47
 * @method self                             setPaymentMethod()
48
 * @method self                             setType()
49
 * @method self                             setSlug()
50
 * @method self                             setThumbnail1()
51
 * @method self                             setThumbnail2()
52
 * @method self                             setThumbnail3()
53
 *
54
 * @SuppressWarnings(PHPMD.ShortVariable)
55
 * @SuppressWarnings(PHPMD.TooManyFields)
56
 */
57
abstract class AbstractPaymentOptionEntity extends ResultEntity
58
{
59
    /** @var string $id */
60
    protected $id;
61
62
    /** @var string $name */
63
    protected $name;
64
65
    /** @var bool $status */
66
    protected $status;
67
68
    /** @var bool $isRedirectMethod */
69
    protected $isRedirectMethod;
70
71
    /** @var float $variableFee */
72
    protected $variableFee;
73
74
    /** @var float $fixedFee */
75
    protected $fixedFee;
76
77
    /** @var string $descriptionOffer */
78
    protected $descriptionOffer;
79
80
    /** @var string $descriptionFee */
81
    protected $descriptionFee;
82
83
    /** @var float $min */
84
    protected $min;
85
86
    /** @var float $max */
87
    protected $max;
88
89
    /** @var string $paymentMethod */
90
    protected $paymentMethod;
91
92
    /** @var string $type */
93
    protected $type;
94
95
    /** @var string $slug */
96
    protected $slug;
97
98
    /** @var string $thumbnail1 */
99
    protected $thumbnail1;
100
101
    /** @var string $thumbnail2 */
102
    protected $thumbnail2;
103
104
    /** @var string $thumbnail3 */
105
    protected $thumbnail3;
106
107
    /** @var PaymentOptionOptionsEntity $options */
108
    protected $options;
109
110
    /** @var PaymentOptionTranslationEntity[] $translations */
111
    protected $translations;
112
113
    /**
114
     * Is redirect method
115
     *
116
     * @return bool
117
     */
118
    public function isRedirectMethod()
119
    {
120
        return (bool) $this->isRedirectMethod;
121
    }
122
123
    /**
124
     * Sets Status
125
     *
126
     * @param string $status
127
     */
128
    public function setStatus($status)
129
    {
130
        $this->status = $status == 'active';
131
    }
132
133
    /**
134
     * Sets Options
135
     *
136
     * @param array $options
137
     */
138
    public function setOptions($options)
139
    {
140
        $this->options = new PaymentOptionOptionsEntity($options);
141
    }
142
143
    /**
144
     * Sets Translations
145
     *
146
     * @param array $translations
147
     */
148
    public function setTranslations($translations)
149
    {
150
        $this->translations = [];
151
152
        foreach ($translations as $item) {
153
            $this->translations[] = new PaymentOptionTranslationEntity($item);
154
        }
155
    }
156
}
157