AbstractMessage   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 60
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 6
lcom 1
cbo 0
dl 0
loc 60
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getProtocolVersion() 0 4 1
A getHeaders() 0 4 1
A getHeader() 0 4 2
A hasHeader() 0 4 1
A getContent() 0 4 1
1
<?php
2
3
namespace Saxulum\HttpClient;
4
5
abstract class AbstractMessage
6
{
7
    /**
8
     * @var string
9
     */
10
    protected $protocolVersion;
11
12
    /**
13
     * @var array
14
     */
15
    protected $headers;
16
17
    /**
18
     * @var string|null
19
     */
20
    protected $content;
21
22
    /**
23
     * @return string
24
     */
25
    public function getProtocolVersion()
26
    {
27
        return $this->protocolVersion;
28
    }
29
30
    /**
31
     * @return array
32
     */
33
    public function getHeaders()
34
    {
35
        return $this->headers;
36
    }
37
38
    /**
39
     * @param  string      $name
40
     * @param  string|null $default
41
     * @return string|null
42
     */
43
    public function getHeader($name, $default = null)
44
    {
45
        return isset($this->headers[$name]) ? $this->headers[$name] : $default;
46
    }
47
48
    /**
49
     * @param  string $name
50
     * @return bool
51
     */
52
    public function hasHeader($name)
53
    {
54
        return isset($this->headers[$name]);
55
    }
56
57
    /**
58
     * @return string
59
     */
60
    public function getContent()
61
    {
62
        return $this->content;
63
    }
64
}
65