Completed
Pull Request — master (#7)
by John
04:58
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 2
Bugs 0 Features 1
Metric Value
wmc 6
c 2
b 0
f 1
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
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 6
     * @param int $errorCode
34
     */
35 6
    public function __construct($responseText, $errorCode = null)
36 6
    {
37 6
        $this->setResponseText($responseText);
38
        $this->setErrorCode($errorCode);
39
    }
40
41
    /**
42 6
     * @param string $responseText
43
     */
44 6
    public function setResponseText($responseText)
45 6
    {
46
        $this->responseText = $responseText;
47
    }
48
49
    /**
50 6
     * @param int $errorCode
51
     */
52 6
    public function setErrorCode($errorCode)
53 6
    {
54
        $this->errorCode = (int) $errorCode;
55
    }
56
57
    /**
58 4
     * @return string
59
     */
60 4
    public function getResponseText()
61
    {
62
        return $this->responseText;
63
    }
64
65
    /**
66 6
     * @return bool
67
     */
68 6
    public function isError()
69
    {
70
        return (bool) $this->errorCode;
71
    }
72
73
    /**
74 4
     * @return int
75
     */
76 4
    public function getErrorCode()
77
    {
78
        return $this->errorCode;
79
    }
80
}
81