Dynamark3Response   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 62
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

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

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
     * @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