Info::getMinutesAttribute()   A
last analyzed

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
 * Info
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 Info 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 getSessionIdAttribute()
31
	{
32 1
		return str_replace($this->accountId, '', $this->engagementId);
0 ignored issues
show
Bug introduced by
The property engagementId does not seem to exist on LivePersonInc\LiveEngageLaravel\Models\Info. Are you sure there is no database migration missing?

Checks if undeclared accessed properties appear in database migrations and if the creating migration is correct.

Loading history...
Bug introduced by
The property accountId does not seem to exist on LivePersonInc\LiveEngageLaravel\Models\Info. Are you sure there is no database migration missing?

Checks if undeclared accessed properties appear in database migrations and if the creating migration is correct.

Loading history...
33
	}
34
35 1
	public function getMinutesAttribute()
36
	{
37 1
		return round($this->attributes['duration'] / 60, 2);
38
	}
39
40 1
	public function getSecondsAttribute()
41
	{
42 1
		return $this->attributes['duration'];
43
	}
44
45 1
	public function getHoursAttribute()
46
	{
47 1
		return round($this->minutes / 60, 2);
48
	}
49
}
50