Completed
Pull Request — master (#4)
by John
02:26
created

Dynamark3Response   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 62
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 6
c 1
b 0
f 0
lcom 1
cbo 0
dl 0
loc 62
ccs 16
cts 16
cp 1
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A setResponseText() 0 4 1
A setErrorCode() 0 4 1
A getResponseText() 0 4 1
A isError() 0 4 1
A getErrorCode() 0 4 1
1
<?php
2
3
/**
4
 * This file is part of graze/dynamark3-client.
5
 *
6
 * Copyright (c) 2016 Nature Delivered Ltd. <https://www.graze.com>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 *
11
 * @license https://github.com/graze/dynamark3-client/blob/master/LICENSE.md
12
 * @link https://github.com/graze/dynamark3-client
13
 */
14
15
namespace Graze\Dynamark3Client;
16
17
class Dynamark3Response
18
{
19
    /**
20
     * @var string
21
     */
22
    protected $responseText;
23
24
    /**
25
     * @var int
26
     */
27
    protected $errorCode;
28
29
    /**
30
     * @param string $responseText
31
     * @param int $errorCode
32
     */
33 6
    public function __construct($responseText, $errorCode = null)
34
    {
35 6
        $this->setResponseText($responseText);
36 6
        $this->setErrorCode($errorCode);
37 6
    }
38
39
    /**
40
     * @param string $responseText
41
     */
42 6
    public function setResponseText($responseText)
43
    {
44 6
        $this->responseText = $responseText;
45 6
    }
46
47
    /**
48
     * @param int $errorCode
49
     */
50 6
    public function setErrorCode($errorCode)
51
    {
52 6
        $this->errorCode = (int) $errorCode;
53 6
    }
54
55
    /**
56
     * @return string
57
     */
58 4
    public function getResponseText()
59
    {
60 4
        return $this->responseText;
61
    }
62
63
    /**
64
     * @return bool
65
     */
66 6
    public function isError()
67
    {
68 6
        return (bool) $this->errorCode;
69
    }
70
71
    /**
72
     * @return int
73
     */
74 4
    public function getErrorCode()
75
    {
76 4
        return $this->errorCode;
77
    }
78
}
79