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

mlocati / PayWay / 5212705470

pending completion
5212705470

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

72.5
/src/Service/BaseResponseTrait.php
1
<?php
2

3
namespace MLocati\PayWay\Service;
4

5
use DateTime;
6
use DateTimeInterface;
7
use DOMElement;
8

9
trait BaseResponseTrait
10
{
11
    use JsonCleanupTrait;
12

13
    /**
14
     * @var string
15
     */
16
    private $tid = '';
17

18
    /**
19
     * @var string
20
     */
21
    private $payInstr = '';
22

23
    /**
24
     * @var \DateTimeInterface|null
25
     */
26
    private $reqTime;
27

28
    /**
29
     * @var string
30
     */
31
    private $rc = '';
32

33
    /**
34
     * @var bool
35
     */
36
    private $error = false;
37

38
    /**
39
     * @var string
40
     */
41
    private $errorDesc = '';
42

43
    /**
44
     * @var string
45
     */
46
    private $signature = '';
47

48
    /**
49
     * @var string[]
50
     */
51
    private $unrecognizedXmlElements = [];
52

53
    /**
54
     * @return string
55
     */
56
    public function getTid()
57
    {
58
        return $this->tid;
2✔
59
    }
60

61
    /**
62
     * @param string $value
63
     *
64
     * @return $this
65
     */
66
    public function setTid($value)
67
    {
68
        $this->tid = (string) $value;
4✔
69

70
        return $this;
4✔
71
    }
72

73
    /**
74
     * @return string
75
     */
76
    public function getPayInstr()
77
    {
78
        return $this->payInstr;
2✔
79
    }
80

81
    /**
82
     * @param string $value
83
     *
84
     * @return $this
85
     */
86
    public function setPayInstr($value)
87
    {
88
        $this->payInstr = (string) $value;
1✔
89

90
        return $this;
1✔
91
    }
92

93
    /**
94
     * @return $this
95
     */
96
    public function getReqTime()
97
    {
98
        return $this->reqTime;
2✔
99
    }
100

101
    /**
102
     * @return $this
103
     */
104
    public function setReqTime(DateTimeInterface $value = null)
105
    {
106
        $this->reqTime = $value;
×
107

108
        return $this;
×
109
    }
110

111
    /**
112
     * @return string
113
     */
114
    public function getRc()
115
    {
116
        return $this->rc;
2✔
117
    }
118

119
    /**
120
     * @param string $value
121
     *
122
     * @return $this
123
     */
124
    public function setRc($value)
125
    {
126
        $this->rc = (string) $value;
4✔
127

128
        return $this;
4✔
129
    }
130

131
    /**
132
     * @return bool
133
     */
134
    public function isError()
135
    {
136
        return $this->error;
2✔
137
    }
138

139
    /**
140
     * @param bool $value
141
     *
142
     * @return $this
143
     */
144
    public function setError($value)
145
    {
146
        $this->error = (bool) $value;
4✔
147

148
        return $this;
4✔
149
    }
150

151
    /**
152
     * @return string
153
     */
154
    public function getErrorDesc()
155
    {
156
        return $this->errorDesc;
2✔
157
    }
158

159
    /**
160
     * @param string $value
161
     *
162
     * @return $this
163
     */
164
    public function setErrorDesc($value)
165
    {
166
        $this->errorDesc = (string) $value;
4✔
167

168
        return $this;
4✔
169
    }
170

171
    /**
172
     * @return string
173
     */
174
    public function getSignature()
175
    {
176
        return $this->signature;
2✔
177
    }
178

179
    /**
180
     * @param string $value
181
     *
182
     * @return $this
183
     */
184
    public function setSignature($value)
185
    {
186
        $this->signature = (string) $value;
4✔
187

188
        return $this;
4✔
189
    }
190

191
    /**
192
     * @return string[]
193
     */
194
    public function getUnrecognizedXmlElements()
195
    {
196
        return $this->unrecognizedXmlElements;
×
197
    }
198

199
    /**
200
     * @param string[]|\DOMElement[] $value
201
     *
202
     * @return $this
203
     */
204
    public function setUnrecognizedXmlElements(array $value)
205
    {
206
        $this->unrecognizedXmlElements = [];
×
207
        foreach ($value as $item) {
×
208
            $this->addUnrecognizedXmlElement($item);
×
209
        }
210

211
        return $this;
×
212
    }
213

214
    /**
215
     * @param string|\DOMElement $value
216
     *
217
     * @return $this
218
     */
219
    public function addUnrecognizedXmlElement($value)
220
    {
221
        if ($value instanceof DOMElement) {
×
222
            $value = $value->ownerDocument->saveXML($value);
×
223
        }
224
        $this->unrecognizedXmlElements[] = $value;
×
225

226
        return $this;
×
227
    }
228

229
    /**
230
     * {@inheritdoc}
231
     *
232
     * @see \JsonSerializable::jsonSerialize()
233
     */
234
    #[\ReturnTypeWillChange]
235
    public function jsonSerialize()
236
    {
237
        return $this->cleanupJson([
4✔
238
            'tid' => $this->tid,
4✔
239
            'payInstr' => $this->payInstr,
4✔
240
            'reqTime' => $this->reqTime === null ? '' : $this->reqTime->format(DateTime::RFC3339),
4✔
241
            'rc' => $this->rc,
4✔
242
            'error' => $this->error,
4✔
243
            'errorDesc' => $this->errorDesc,
4✔
244
            'signature' => $this->signature,
4✔
245
            '_unrecognizedXmlElements' => $this->unrecognizedXmlElements,
4✔
246
        ]);
4✔
247
    }
248
}
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

© 2025 Coveralls, Inc