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

mlocati / PayWay / 5236553593

pending completion
5236553593

push

github

web-flow
Add error page request data, rename server2server handler of received data (#2)

14 of 14 new or added lines in 1 file covered. (100.0%)

1576 of 2070 relevant lines covered (76.14%)

1.49 hits per line

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

78.57
/src/Error/RequestData.php
1
<?php
2

3
namespace MLocati\PayWay\Error;
4

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

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

12
    /**
13
     * @var string
14
     */
15
    private $rc;
16

17
    /**
18
     * @var array
19
     */
20
    private $unrecognizedData;
21

22
    public function __construct(array $data)
23
    {
24
        $this->rc = static::popString($data, 'rc');
5✔
25
        $this->unrecognizedData = $data;
5✔
26
    }
27

28
    /**
29
     * @return static
30
     */
31
    public static function createFromGlobals()
32
    {
33
        return new static(isset($_GET) ? $_GET : []);
×
34
    }
35

36
    /**
37
     * @return string
38
     */
39
    public function getRC()
40
    {
41
        return $this->rc;
×
42
    }
43

44
    /**
45
     * @return array
46
     */
47
    public function getUnrecognizedData()
48
    {
49
        return $this->unrecognizedData;
×
50
    }
51

52
    /**
53
     * {@inheritdoc}
54
     *
55
     * @see \JsonSerializable::jsonSerialize()
56
     */
57
    #[\ReturnTypeWillChange]
58
    public function jsonSerialize()
59
    {
60
        return $this->cleanupJson([
5✔
61
            'rc' => $this->rc,
5✔
62
            '_unrecognizedData' => $this->unrecognizedData,
5✔
63
        ]);
5✔
64
    }
65

66
    /**
67
     * @param string $key
68
     *
69
     * @return string
70
     */
71
    private static function popString(array &$data, $key)
72
    {
73
        if (!isset($data[$key]) || !is_string($data[$key])) {
5✔
74
            return '';
2✔
75
        }
76
        $result = $data[$key];
3✔
77
        unset($data[$key]);
3✔
78

79
        return $result;
3✔
80
    }
81
}
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