Completed
Push — master ( 4e5a32...533976 )
by methylbro
9s
created

CreateCampaignResponse::getCode()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 3

Importance

Changes 0
Metric Value
dl 0
loc 10
ccs 6
cts 6
cp 1
rs 9.4285
c 0
b 0
f 0
cc 3
eloc 6
nc 2
nop 0
crap 3
1
<?php
2
3
/**
4
 * This file is part of the Mediapart Selligent Client API
5
 *
6
 * CC BY-NC-SA <https://github.com/mediapart/selligent>
7
 *
8
 * For the full license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Mediapart\Selligent\Response;
13
14
use Mediapart\Selligent\Response;
15
16
/**
17
 *
18
 */
19
class CreateCampaignResponse extends Response
20
{
21
    /**
22
     *
23
     */
24
    const WARNING = 20001;
25
26
    /**
27
     * @var integer
28
     */
29
    protected $CreateCampaignResult;
30
31
    /**
32
     * @var string
33
     */
34
    protected $Xml;
35
36
    /**
37
     *
38
     */
39 2
    public function __construct()
40
    {
41 2
        $this->CreateCampaignResult = Response::ERROR_NORESULT;
42 2
        $this->Xml = '';
43 2
    }
44
45
    /**
46
     * {@inheritDoc}
47
     */
48 2
    public function getCode()
49
    {
50 2
        if (self::SUCCESSFUL == $this->CreateCampaignResult && !empty($this->ErrorStr)) {
51 1
            $code = self::WARNING;
52 1
        } else {
53 1
            $code = $this->CreateCampaignResult;
54
        }
55
56 2
        return $code;
57
    }
58
59
    /**
60
     * @return string Xml
61
     */
62 1
    public function getXml()
63
    {
64 1
        return $this->Xml;
65
    }
66
}
67