Passed
Push — master ( a2c862...16044f )
by Robert
05:35
created

MessagingInfo::getHoursAttribute()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 1
nc 1
nop 0
crap 1
1
<?php
2
/**
3
 * MessagingInfo
4
 *
5
 * @package LivePersonInc\LiveEngageLaravel\Models
6
 */
7
8
namespace LivePersonInc\LiveEngageLaravel\Models;
9
10
use Carbon\Carbon;
11
use Illuminate\Database\Eloquent\Model;
12
13
class MessagingInfo extends Model
14
{
15
	protected $guarded = [];
16
	protected $appends = [
17
		'startTime',
18
		'endTime'
19
	];
20
21 1
	public function getStartTimeAttribute()
22
	{
23 1
		return new Carbon($this->attributes['startTime']);
24
	}
25
	
26 1
	public function getEndTimeAttribute()
27
	{
28 1
		return new Carbon($this->attributes['endTime']);
29
	}
30
31 1
	public function getMinutesAttribute()
32
	{
33 1
		return round(($this->attributes['duration'] / 1000) / 60, 2);
34
	}
35
36 1
	public function getSecondsAttribute()
37
	{
38 1
		return $this->attributes['duration'] / 1000;
39
	}
40
41 1
	public function getHoursAttribute()
42
	{
43 1
		return round($this->minutes / 60, 2);
44
	}
45
}
46