• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mlocati / PayWay / 5213927880

pending completion
5213927880

push

github

mlocati
Initial version

1803 of 1803 new or added lines in 47 files covered. (100.0%)

1313 of 1803 relevant lines covered (72.82%)

1.53 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

87.5
/src/Service/Level3Info/Product.php
1
<?php
2

3
namespace MLocati\PayWay\Service\Level3Info;
4

5
use JsonSerializable;
6
use MLocati\PayWay\Service\JsonCleanupTrait;
7

8
class Product implements JsonSerializable
9
{
10
    use JsonCleanupTrait;
11

12
    /**
13
     * Undocumented.
14
     *
15
     * @var string
16
     */
17
    private $productCode = '';
18

19
    /**
20
     * Undocumented.
21
     *
22
     * @var string
23
     */
24
    private $productDescription = '';
25

26
    /**
27
     * Undocumented.
28
     *
29
     * @var int|null
30
     */
31
    private $items;
32

33
    /**
34
     * Undocumented.
35
     *
36
     * @var int|null
37
     *
38
     * @example 0.07 EUR = 7
39
     * @example 1.00 EUR = 100
40
     * @example 12.05 EUR = 1205
41
     */
42
    private $amount;
43

44
    /**
45
     * Undocumented.
46
     *
47
     * @var string
48
     */
49
    private $imgURL = '';
50

51
    /**
52
     * @return string
53
     */
54
    public function getProductCode()
55
    {
56
        return $this->productCode;
1✔
57
    }
58

59
    /**
60
     * @param string $value
61
     *
62
     * @return $this
63
     */
64
    public function setProductCode($value)
65
    {
66
        $this->productCode = (string) $value;
2✔
67

68
        return $this;
2✔
69
    }
70

71
    /**
72
     * @return string
73
     */
74
    public function getProductDescription()
75
    {
76
        return $this->productDescription;
1✔
77
    }
78

79
    /**
80
     * @param string $value
81
     *
82
     * @return $this
83
     */
84
    public function setProductDescription($value)
85
    {
86
        $this->productDescription = $value;
2✔
87

88
        return $this;
2✔
89
    }
90

91
    /**
92
     * @return int|null
93
     */
94
    public function getItems()
95
    {
96
        return $this->items;
1✔
97
    }
98

99
    /**
100
     * @param int|null $value
101
     *
102
     * @return $this
103
     */
104
    public function setItems($value)
105
    {
106
        $this->items = $value === null || $value === '' ? null : (int) $value;
2✔
107

108
        return $this;
2✔
109
    }
110

111
    /**
112
     * Undocumented.
113
     *
114
     * @return float|int|null
115
     *
116
     * @example 0.07 EUR = 0.07
117
     * @example 1.00 EUR = 1
118
     * @example 12.05 EUR = 12.05
119
     *
120
     * @see \MLocati\PayWay\Service\Level3Info\Product::getAmountAsCents()
121
     */
122
    public function getAmountAsFloat()
123
    {
124
        return $this->amount === null ? null : ((float) $this->amount) / 100.;
×
125
    }
126

127
    /**
128
     * Undocumented.
129
     *
130
     * @param float|int|null $value
131
     *
132
     * @return $this
133
     *
134
     * @example 0.07 EUR = 0.07
135
     * @example 1.00 EUR = 1
136
     * @example 12.05 EUR = 12.05
137
     *
138
     * @see \MLocati\PayWay\Service\Level3Info\Product::setAmountAsCents()
139
     */
140
    public function setAmountAsFloat($value)
141
    {
142
        return $this->setAmountAsCents(empty($value) ? $value : round((float) $value * 100.));
1✔
143
    }
144

145
    /**
146
     * Undocumented.
147
     *
148
     * @var int|null
149
     *
150
     * @example 0.07 EUR = 7
151
     * @example 1.00 EUR = 100
152
     * @example 12.05 EUR = 1205
153
     *
154
     * @see \MLocati\PayWay\Service\Level3Info\Product::getAmountAsFloat()
155
     */
156
    public function getAmountAsCents()
157
    {
158
        return $this->amount;
1✔
159
    }
160

161
    /**
162
     * Undocumented.
163
     *
164
     * @param int|null $value
165
     *
166
     * @return $this
167
     *
168
     * @example 0.07 EUR = 7
169
     * @example 1.00 EUR = 100
170
     * @example 12.05 EUR = 1205
171
     *
172
     * @see \MLocati\PayWay\Service\Level3Info\Product::setAmountAsFloat()
173
     */
174
    public function setAmountAsCents($value)
175
    {
176
        $this->amount = $value === null || $value === '' ? null : (int) $value;
2✔
177

178
        return $this;
2✔
179
    }
180

181
    /**
182
     * @return string
183
     */
184
    public function getImgURL()
185
    {
186
        return $this->imgURL;
1✔
187
    }
188

189
    /**
190
     * @param string $value
191
     *
192
     * @return $this
193
     */
194
    public function setImgURL($value)
195
    {
196
        $this->imgURL = (string) $value;
×
197

198
        return $this;
×
199
    }
200

201
    /**
202
     * {@inheritdoc}
203
     *
204
     * @see \JsonSerializable::jsonSerialize()
205
     */
206
    #[\ReturnTypeWillChange]
207
    public function jsonSerialize()
208
    {
209
        return $this->cleanupJson([
2✔
210
            'productCode' => $this->productCode,
2✔
211
            'productDescription' => $this->productDescription,
2✔
212
            'items' => $this->items,
2✔
213
            'amount' => $this->amount,
2✔
214
            'imgURL' => $this->imgURL,
2✔
215
        ]);
2✔
216
    }
217
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc