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

Dynamark3Response::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 5
ccs 4
cts 4
cp 1
rs 9.4285
nc 1
cc 1
eloc 3
nop 2
crap 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