HarvestTimeEntry::setProject()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
rs 10
1
<?php
2
/**
3
 * SaaS Link plugin for Craft CMS 3.x
4
 *
5
 * @link      https://workingconcept.com
6
 * @copyright Copyright (c) 2018 Working Concept Inc.
7
 */
8
9
namespace workingconcept\saaslink\models\harvest;
10
11
use craft\base\Model;
12
13
/**
14
 * Harvest Time Entry Model
15
 * https://help.getharvest.com/api-v2/timesheets-api/timesheets/time-entries/
16
 */
17
18
class HarvestTimeEntry extends Model
19
{
20
    // Properties
21
    // =========================================================================
22
23
    /**
24
     * @var int Unique ID for the time entry.
25
     */
26
    public $id;
27
28
    /**
29
     * @var string Date of the time entry.
30
     */
31
    public $spent_date;
32
33
    /**
34
     * @var object An object containing the id and name of the associated user.
35
     */
36
    private $_user;
37
38
    /**
39
     * @var object A user assignment object of the associated user.
40
     */
41
    private $_user_assignment;
42
43
    /**
44
     * @var object An object containing the id and name of the associated client.
45
     */
46
    private $_client;
47
48
    /**
49
     * @var object An object containing the id and name of the associated project.
50
     */
51
    private $_project;
52
53
    /**
54
     * @var object An object containing the id and name of the associated task.
55
     */
56
    private $_task;
57
58
    /**
59
     * @var object A task assignment object of the associated task.
60
     */
61
    private $_task_assignment;
62
63
    /**
64
     * @var object An object containing the id, group_id, permalink, service, and service_icon_url of the associated external reference.
65
     */
66
    private $_external_reference;
67
68
    /**
69
     * @var object Once the time entry has been invoiced, this field will include the associated invoice’s id and number.
70
     */
71
    private $_invoice;
72
73
    /**
74
     * @var float Number of (decimal time) hours tracked in this time entry.
75
     */
76
    public $hours;
77
78
    /**
79
     * @var string Notes attached to the time entry.
80
     */
81
    public $notes;
82
83
    /**
84
     * @var bool Whether or not the time entry has been locked.
85
     */
86
    public $is_locked;
87
88
    /**
89
     * @var string Why the time entry has been locked.
90
     */
91
    public $locked_reason;
92
93
    /**
94
     * @var bool Whether or not the time entry has been approved via Timesheet Approval.
95
     */
96
    public $is_closed;
97
98
    /**
99
     * @var bool Whether or not the time entry has been marked as invoiced.
100
     */
101
    public $is_billed;
102
103
    /**
104
     * @var string Date and time the timer was started (if tracking by duration). Use the ISO 8601 Format.
105
     */
106
    public $timer_started_at;
107
108
    /**
109
     * @var string Time the time entry was started (if tracking by start/end times).
110
     */
111
    public $started_time;
112
113
    /**
114
     * @var string Time the time entry was ended (if tracking by start/end times).
115
     */
116
    public $ended_time;
117
118
    /**
119
     * @var bool Whether or not the time entry is currently running.
120
     */
121
    public $is_running;
122
123
    /**
124
     * @var bool Whether or not the time entry is billable.
125
     */
126
    public $billable;
127
128
    /**
129
     * @var bool Whether or not the time entry counts towards the project budget.
130
     */
131
    public $budgeted;
132
133
    /**
134
     * @var float The billable rate for the time entry.
135
     */
136
    public $billable_rate;
137
138
    /**
139
     * @var float The cost rate for the time entry.
140
     */
141
    public $cost_rate;
142
143
    /**
144
     * @var string Date and time the time entry was created. Use the ISO 8601 Format.
145
     */
146
    public $created_at;
147
148
    /**
149
     * @var string Date and time the time entry was last updated. Use the ISO 8601 Format.
150
     */
151
    public $updated_at;
152
153
154
    // Public Methods
155
    // =========================================================================
156
157
    public function getUser()
158
    {
159
        return $this->_user;
160
    }
161
    
162
    public function setUser($user)
163
    {
164
        return $this->_user = $user;
165
    }
166
    
167
    public function getUserAssignment()
168
    {
169
        return $this->_user_assignment;
170
    }
171
    
172
    public function setUser_Assignment($userAssignment)
173
    {
174
        return $this->_user_assignment = $userAssignment;
175
    }
176
    
177
    public function getClient()
178
    {
179
        return $this->_client;
180
    }
181
    
182
    public function setClient($client)
183
    {
184
        return $this->_client = $client;
185
    }
186
    
187
    public function getProject()
188
    {
189
        return $this->_project;
190
    }
191
    
192
    public function setProject($project)
193
    {
194
        return $this->_project = $project;
195
    }
196
    
197
    public function getTask()
198
    {
199
        return $this->_task;
200
    }
201
    
202
    public function setTask($task)
203
    {
204
        return $this->_task = $task;
205
    }
206
    
207
    public function getTaskAssignment()
208
    {
209
        return $this->_task_assignment;
210
    }
211
    
212
    public function setTask_Assignment($taskAssignment)
213
    {
214
        return $this->_task_assignment = $taskAssignment;
215
    }
216
    
217
    public function getExternalReference()
218
    {
219
        return $this->_external_reference;
220
    }
221
    
222
    public function setExternal_Reference($externalReference)
223
    {
224
        return $this->_external_reference = $externalReference;
225
    }
226
    
227
    public function getInvoice()
228
    {
229
        return $this->_invoice;
230
    }
231
    
232
    public function setInvoice($invoice)
233
    {
234
        return $this->_invoice = $invoice;
235
    }
236
    
237
    public function rules()
238
    {
239
        return [
240
            [[
241
                'id', 
242
             ], 'number', 'integerOnly' => true],
243
            [['id'], 'required'],
244
            [[
245
                'hours', 
246
                'billable_rate', 
247
                'cost_rate', 
248
             ], 'number', 'integerOnly' => false],
249
            [[
250
                'spent_date', 
251
                'notes', 
252
                'locked_reason', 
253
                'timer_started_at', 
254
                'started_time', 
255
                'ended_time', 
256
                'created_at', 
257
                'updated_at', 
258
             ], 'string'],
259
            [[
260
                'is_locked', 
261
                'locked_reason', 
262
                'is_closed', 
263
                'is_billed', 
264
                'is_running', 
265
                'billable', 
266
                'budgeted', 
267
             ], 'boolean'],
268
        ];
269
    }
270
}
271