Passed
Push — master ( 8652e1...ae54b4 )
by Robert
03:22
created

MessagingInfo::getSecondsAttribute()   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
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 1
	public function getStartTimeAttribute()
16
	{
17 1
		return new Carbon($this->attributes['startTime']);
18
	}
19
20 1
	public function getMinutesAttribute()
21
	{
22 1
		return round(($this->attributes['duration'] / 1000) / 60, 2);
23
	}
24
25 1
	public function getSecondsAttribute()
26
	{
27 1
		return $this->attributes['duration'] / 1000;
28
	}
29
30 1
	public function getHoursAttribute()
31
	{
32 1
		return round($this->minutes / 60, 2);
33
	}
34
}
35