Passed
Push — master ( 52f2c7...a2c862 )
by Robert
06:42
created

MessagingInfo   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Test Coverage

Coverage 80%

Importance

Changes 0
Metric Value
wmc 5
eloc 9
dl 0
loc 30
c 0
b 0
f 0
ccs 8
cts 10
cp 0.8
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getHoursAttribute() 0 3 1
A getEndTimeAttribute() 0 3 1
A getStartTimeAttribute() 0 3 1
A getSecondsAttribute() 0 3 1
A getMinutesAttribute() 0 3 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
	];
19
20 1
	public function getStartTimeAttribute()
21
	{
22 1
		return new Carbon($this->attributes['startTime']);
23
	}
24
	
25
	public function getEndTimeAttribute()
26
	{
27
		return new Carbon($this->attributes['endTime']);
28
	}
29
30 1
	public function getMinutesAttribute()
31
	{
32 1
		return round(($this->attributes['duration'] / 1000) / 60, 2);
33
	}
34
35 1
	public function getSecondsAttribute()
36
	{
37 1
		return $this->attributes['duration'] / 1000;
38
	}
39
40 1
	public function getHoursAttribute()
41
	{
42 1
		return round($this->minutes / 60, 2);
43
	}
44
}
45