Passed
Branch master (c45254)
by Robert
03:51
created

MessagingInfo   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 4
dl 0
loc 25
ccs 0
cts 8
cp 0
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getStartTimeAttribute() 0 3 1
A getHoursAttribute() 0 3 1
A getSecondsAttribute() 0 3 1
A getMinutesAttribute() 0 3 1
1
<?php
2
3
namespace LivePersonInc\LiveEngageLaravel\Models;
4
5
use Carbon\Carbon;
6
use Illuminate\Database\Eloquent\Model;
7
8
class MessagingInfo extends Model
9
{
10
	protected $guarded = [];
11
	protected $appends = [
12
		'startTime',
13
	];
14
15
	public function getStartTimeAttribute()
16
	{
17
		return new Carbon($this->attributes['startTime']);
18
	}
19
20
	public function getMinutesAttribute()
21
	{
22
		return round(($this->attributes['duration'] / 1000) / 60, 2);
23
	}
24
25
	public function getSecondsAttribute()
26
	{
27
		return $this->attributes['duration'] / 1000;
28
	}
29
30
	public function getHoursAttribute()
31
	{
32
		return round($this->minutes / 60, 2);
33
	}
34
}
35