Dynamark3Response::setErrorCode()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 1
dl 0
loc 4
ccs 3
cts 3
cp 1
crap 1
rs 10
c 0
b 0
f 0
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
use Graze\Dynamark3Client\Dynamark3ResponseInterface;
18
19
class Dynamark3Response implements Dynamark3ResponseInterface
20
{
21
    /**
22
     * @var string
23
     */
24
    protected $responseText;
25
26
    /**
27
     * @var int
28
     */
29
    protected $errorCode;
30
31
    /**
32
     * @param string $responseText
33
     * @param int    $errorCode
34
     */
35 8
    public function __construct($responseText, $errorCode = null)
36
    {
37 8
        $this->setResponseText($responseText);
38 8
        $this->setErrorCode($errorCode);
39 8
    }
40
41
    /**
42
     * @param string $responseText
43
     */
44 8
    public function setResponseText($responseText)
45
    {
46 8
        $this->responseText = $responseText;
47 8
    }
48
49
    /**
50
     * @param int $errorCode
51
     */
52 8
    public function setErrorCode($errorCode)
53
    {
54 8
        $this->errorCode = (int) $errorCode;
55 8
    }
56
57
    /**
58
     * @return string
59
     */
60 5
    public function getResponseText()
61
    {
62 5
        return $this->responseText;
63
    }
64
65
    /**
66
     * @return bool
67
     */
68 8
    public function isError()
69
    {
70 8
        return (bool) $this->errorCode;
71
    }
72
73
    /**
74
     * @return int
75
     */
76 5
    public function getErrorCode()
77
    {
78 5
        return $this->errorCode;
79
    }
80
}
81