ResultAtBatchDto::setResult()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace SalesforceBulkApi\dto;
4
5
use BaseHelpers\hydrators\ConstructFromArrayOrJson;
6
7
class ResultAtBatchDto extends ConstructFromArrayOrJson
8
{
9
    /**
10
     * @var string
11
     */
12
    protected $id;
13
14
    /**
15
     * @var bool
16
     */
17
    protected $success;
18
19
    /**
20
     * @var bool
21
     */
22
    protected $created;
23
24
    /**
25
     * For resultId from Query batch
26
     *
27
     * @var string
28
     */
29
    protected $result;
30
31
    /**
32
     * @var array
33
     */
34
    protected $errors;
35
36
    public function __construct($params = null)
37
    {
38
        parent::__construct($params);
39
        if (empty($this->id) && is_string($params)) {
40
            $this->result = $params;
41
        }
42
    }
43
44
    /**
45
     * @return string
46
     */
47
    public function getId()
48
    {
49
        return $this->id;
50
    }
51
52
    /**
53
     * @return bool
54
     */
55
    public function isSuccess()
56
    {
57
        return $this->success;
58
    }
59
60
    /**
61
     * @param bool $success
62
     *
63
     * @return $this
64
     */
65
    protected function setSuccess($success)
66
    {
67
        $this->success = (bool)$success;
68
        return $this;
69
    }
70
71
    /**
72
     * @return bool
73
     */
74
    public function isCreated()
75
    {
76
        return $this->created;
77
    }
78
79
    /**
80
     * @param bool $created
81
     *
82
     * @return $this
83
     */
84
    protected function setCreated($created)
85
    {
86
        $this->created = (bool)$created;
87
        return $this;
88
    }
89
90
    /**
91
     * @return array
92
     */
93
    public function getErrors()
94
    {
95
        return $this->errors;
96
    }
97
98
    /**
99
     * @return string
100
     */
101
    public function getResult()
102
    {
103
        return $this->result;
104
    }
105
106
    /**
107
     * @param string $result
108
     *
109
     * @return $this
110
     */
111
    public function setResult($result)
112
    {
113
        $this->result = $result;
114
        return $this;
115
    }
116
}