Note   A
last analyzed

Complexity

Total Complexity 8

Size/Duplication

Total Lines 117
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 8
eloc 29
dl 0
loc 117
rs 10
c 0
b 0
f 0

8 Methods

Rating   Name   Duplication   Size   Complexity  
A isEditable() 0 3 1
A setCreatedUser() 0 5 1
A setPhone() 0 5 1
A getExtraRaw() 0 12 1
A setAttachment() 0 5 1
A getAttachment() 0 3 1
A loadInRaw() 0 7 1
A setService() 0 5 1
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: DrillCoder
5
 * Date: 17.09.17
6
 * Time: 20:28
7
 */
8
9
namespace DrillCoder\AmoCRM_Wrap;
10
11
use stdClass;
12
13
/**
14
 * Class Note
15
 * @package DrillCoder\AmoCRM_Wrap
16
 */
17
class Note extends BaseEntity
18
{
19
    /**
20
     * @var bool
21
     */
22
    private $editable;
23
24
    /**
25
     * @var string
26
     */
27
    private $attachment;
28
29
    /**
30
     * @var string
31
     */
32
    private $service;
33
34
    /**
35
     * @var string
36
     */
37
    private $phone;
38
39
    /**
40
     * @param stdClass $data
41
     *
42
     * @return Note
43
     *
44
     * @throws AmoWrapException
45
     */
46
    public function loadInRaw($data)
47
    {
48
        BaseEntity::loadInRaw($data);
49
        $this->editable = $data->is_editable;
50
        $this->attachment = $data->attachment;
51
52
        return $this;
53
    }
54
55
    /**
56
     * @return bool
57
     */
58
    public function isEditable()
59
    {
60
        return $this->editable;
61
    }
62
63
    /**
64
     * @return string
65
     */
66
    public function getAttachment()
67
    {
68
        return $this->attachment;
69
    }
70
71
    /**
72
     * @param string $attachment
73
     *
74
     * @return Note
75
     */
76
    public function setAttachment($attachment)
77
    {
78
        $this->attachment = $attachment;
79
80
        return $this;
81
    }
82
83
    /**
84
     * @param string $service
85
     *
86
     * @return Note
87
     */
88
    public function setService($service)
89
    {
90
        $this->service = $service;
91
92
        return $this;
93
    }
94
95
    /**
96
     * @param $phone
97
     *
98
     * @return $this
99
     */
100
    public function setPhone($phone)
101
    {
102
        $this->phone = $phone;
103
104
        return $this;
105
    }
106
107
    /**
108
     * @param string $userId
109
     *
110
     * @return $this
111
     */
112
    public function setCreatedUser($userId)
113
    {
114
        $this->createdUserId = $userId;
115
116
        return $this;
117
    }
118
119
    /**
120
     * @return array
121
     */
122
    protected function getExtraRaw()
123
    {
124
        return array(
125
            'element_id' => $this->elementId,
126
            'element_type' => $this->elementType,
127
            'note_type' => $this->type,
128
            'text' => $this->text,
129
            'created_by' => $this->createdUserId,
130
            'params' => array(
131
                'text' => $this->text,
132
                'service' => $this->service,
133
                'phone' => $this->phone,
134
            ),
135
        );
136
    }
137
}