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

codeigniter4 / CodeIgniter4 / 8677009716

13 Apr 2024 11:45PM UTC coverage: 84.44% (-2.2%) from 86.607%
8677009716

push

github

web-flow
Merge pull request #8776 from kenjis/fix-findQualifiedNameFromPath-Cannot-declare-class-v3

fix: Cannot declare class CodeIgniter\Config\Services, because the name is already in use

0 of 3 new or added lines in 1 file covered. (0.0%)

478 existing lines in 72 files now uncovered.

20318 of 24062 relevant lines covered (84.44%)

188.23 hits per line

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

86.67
/system/HTTP/Message.php
1
<?php
2

3
declare(strict_types=1);
4

5
/**
6
 * This file is part of CodeIgniter 4 framework.
7
 *
8
 * (c) CodeIgniter Foundation <admin@codeigniter.com>
9
 *
10
 * For the full copyright and license information, please view
11
 * the LICENSE file that was distributed with this source code.
12
 */
13

14
namespace CodeIgniter\HTTP;
15

16
use InvalidArgumentException;
17

18
/**
19
 * An HTTP message
20
 *
21
 * @see \CodeIgniter\HTTP\MessageTest
22
 */
23
class Message implements MessageInterface
24
{
25
    use MessageTrait;
26

27
    /**
28
     * Protocol version
29
     *
30
     * @var string
31
     */
32
    protected $protocolVersion;
33

34
    /**
35
     * List of valid protocol versions
36
     *
37
     * @var array
38
     */
39
    protected $validProtocolVersions = [
40
        '1.0',
41
        '1.1',
42
        '2.0',
43
        '3.0',
44
    ];
45

46
    /**
47
     * Message body
48
     *
49
     * @var string|null
50
     */
51
    protected $body;
52

53
    /**
54
     * Returns the Message's body.
55
     *
56
     * @return string|null
57
     */
58
    public function getBody()
59
    {
60
        return $this->body;
291✔
61
    }
62

63
    /**
64
     * Returns an array containing all headers.
65
     *
66
     * @return array<string, Header> An array of the request headers
67
     *
68
     * @deprecated Use Message::headers() to make room for PSR-7
69
     *
70
     * @TODO Incompatible return value with PSR-7
71
     *
72
     * @codeCoverageIgnore
73
     */
74
    public function getHeaders(): array
75
    {
UNCOV
76
        return $this->headers();
×
77
    }
78

79
    /**
80
     * Returns a single header object. If multiple headers with the same
81
     * name exist, then will return an array of header objects.
82
     *
83
     * @return array|Header|null
84
     *
85
     * @deprecated Use Message::header() to make room for PSR-7
86
     *
87
     * @TODO Incompatible return value with PSR-7
88
     *
89
     * @codeCoverageIgnore
90
     */
91
    public function getHeader(string $name)
92
    {
UNCOV
93
        return $this->header($name);
×
94
    }
95

96
    /**
97
     * Determines whether a header exists.
98
     */
99
    public function hasHeader(string $name): bool
100
    {
101
        $origName = $this->getHeaderName($name);
328✔
102

103
        return isset($this->headers[$origName]);
328✔
104
    }
105

106
    /**
107
     * Retrieves a comma-separated string of the values for a single header.
108
     *
109
     * This method returns all of the header values of the given
110
     * case-insensitive header name as a string concatenated together using
111
     * a comma.
112
     *
113
     * NOTE: Not all header values may be appropriately represented using
114
     * comma concatenation. For such headers, use getHeader() instead
115
     * and supply your own delimiter when concatenating.
116
     */
117
    public function getHeaderLine(string $name): string
118
    {
119
        if ($this->hasMultipleHeaders($name)) {
1,193✔
120
            throw new InvalidArgumentException(
1✔
121
                'The header "' . $name . '" already has multiple headers.'
1✔
122
                . ' You cannot use getHeaderLine().'
1✔
123
            );
1✔
124
        }
125

126
        $origName = $this->getHeaderName($name);
1,192✔
127

128
        if (! array_key_exists($origName, $this->headers)) {
1,192✔
129
            return '';
1,007✔
130
        }
131

132
        return $this->headers[$origName]->getValueLine();
283✔
133
    }
134

135
    /**
136
     * Returns the HTTP Protocol Version.
137
     */
138
    public function getProtocolVersion(): string
139
    {
140
        return $this->protocolVersion ?? '1.1';
152✔
141
    }
142
}
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