Passed
Push — master ( cf05b0...ebef44 )
by Gaetano
06:06
created

PayloadBearer   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 1
Metric Value
eloc 9
c 2
b 0
f 1
dl 0
loc 39
rs 10
wmc 4

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getContentType() 0 3 1
A getPayload() 0 3 1
A setPayload() 0 9 2
1
<?php
2
3
namespace PhpXmlRpc\Traits;
4
5
trait PayloadBearer
6
{
7
    /** @var string */
8
    public $payload;
9
    /** @var string */
10
    public $content_type = 'text/xml';
11
12
    /**
13
     * @internal
14
     *
15
     * @param string $payload
16
     * @param string $contentType
17
     * @return $this
18
     */
19
    public function setPayload($payload, $contentType = '')
20
    {
21
        $this->payload = $payload;
22
23
        if ($contentType != '') {
24
            $this->content_type = $contentType;
25
        }
26
27
        return $this;
28
    }
29
30
    /**
31
     * @return string
32
     */
33
    public function getPayload()
34
    {
35
        return $this->payload;
36
    }
37
38
    /**
39
     * @return string
40
     */
41
    public function getContentType()
42
    {
43
        return $this->content_type;
44
    }
45
}
46