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

donatj / mock-webserver / 15544212778

09 Jun 2025 08:42PM UTC coverage: 78.841% (-1.4%) from 80.24%
15544212778

push

github

web-flow
Merge pull request #61 from donatj/feature/phpstan

Add phpstan to ci

5 of 12 new or added lines in 4 files covered. (41.67%)

1 existing line in 1 file now uncovered.

272 of 345 relevant lines covered (78.84%)

4.26 hits per line

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

92.86
/src/Response.php
1
<?php
2

3
namespace donatj\MockWebServer;
4

5
use donatj\MockWebServer\Exceptions\RuntimeException;
6

7
class Response implements ResponseInterface {
8

9
        /** @var string */
10
        protected $body;
11
        /** @var array */
12
        protected $headers;
13
        /** @var int */
14
        protected $status;
15

16
        /**
17
         * Response constructor.
18
         */
19
        public function __construct( string $body, array $headers = [], int $status = 200 ) {
20
                $this->body    = $body;
22✔
21
                $this->headers = $headers;
22✔
22
                $this->status  = $status;
22✔
23
        }
24

25
        public function getRef() : string {
26
                $content = json_encode([
18✔
27
                        $this->body,
18✔
28
                        $this->status,
18✔
29
                        $this->headers,
18✔
30
                ]);
18✔
31

32
                if( $content === false ) {
18✔
NEW
33
                        throw new RuntimeException('Failed to encode response content to JSON: ' . json_last_error_msg());
×
34
                }
35

36
                return md5($content);
18✔
37
        }
38

39
        public function getBody( RequestInfo $request ) : string {
40
                return $this->body;
9✔
41
        }
42

43
        public function getHeaders( RequestInfo $request ) : array {
44
                return $this->headers;
8✔
45
        }
46

47
        public function getStatus( RequestInfo $request ) : int {
48
                return $this->status;
8✔
49
        }
50

51
}
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