• 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

50.0
/src/Http/Response.php
1
<?php
2

3
namespace MLocati\PayWay\Http;
4

5
use JsonSerializable;
6

7
class Response implements JsonSerializable
8
{
9
    /**
10
     * @var int
11
     */
12
    private $code;
13

14
    /**
15
     * @var array keys are the header names, values are strings or (in case of multiple headers) arrays of strings
16
     */
17
    private $headers;
18

19
    /**
20
     * @var string
21
     */
22
    private $body;
23

24
    /**
25
     * @param int $code
26
     * @param array $headers keys are the header names, values are strings or (in case of multiple headers) arrays of strings
27
     * @param string $body
28
     */
29
    public function __construct($code, array $headers, $body)
30
    {
31
        $this->code = (int) $code;
3✔
32
        $this->headers = $headers;
3✔
33
        $this->body = (string) $body;
3✔
34
    }
35

36
    /**
37
     * @return int
38
     */
39
    public function getCode()
40
    {
41
        return $this->code;
1✔
42
    }
43

44
    /**
45
     * @return array keys are the header names, values are strings or (in case of multiple headers) arrays of strings
46
     */
47
    public function getHeaders()
48
    {
49
        return $this->headers;
×
50
    }
51

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

60
    /**
61
     * @return bool
62
     */
63
    public function is2xx()
64
    {
65
        return $this->code >= 200 && $this->code < 300;
3✔
66
    }
67

68
    /**
69
     * {@inheritdoc}
70
     *
71
     * @see \JsonSerializable::jsonSerialize()
72
     */
73
    #[\ReturnTypeWillChange]
74
    public function jsonSerialize()
75
    {
76
        return [
×
77
            'code' => $this->code,
×
78
            'headers' => $this->headers,
×
79
            'body' => $this->body,
×
80
        ];
×
81
    }
82
}
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