Info   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Test Coverage

Coverage 83.33%

Importance

Changes 2
Bugs 2 Features 0
Metric Value
wmc 6
eloc 10
c 2
b 2
f 0
dl 0
loc 35
ccs 10
cts 12
cp 0.8333
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A getEndTimeAttribute() 0 3 1
A getMinutesAttribute() 0 3 1
A getSecondsAttribute() 0 3 1
A getHoursAttribute() 0 3 1
A getSessionIdAttribute() 0 3 1
A getStartTimeAttribute() 0 3 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