Test Failed
Branch development (1f4e65)
by Robert
11:57
created

Agent::getDetailsAttribute()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
ccs 0
cts 0
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 2
1
<?php
2
/**
3
 * Agent
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
use LivePersonInc\LiveEngageLaravel\Facades\LiveEngageLaravel as LiveEngage;
13
14
/**
15
 * Agent class.
16
 * 
17
 * @extends Model
18
 */
19
class Agent extends Model
20
{
21
	/**
22
	 * guarded
23
	 * 
24
	 * (default value: [])
25
	 * 
26
	 * @var mixed
27
	 * @access protected
28
	 */
29
	protected $guarded = [];
30
	
31
	/**
32
	 * userTypes
33
	 * 
34
	 * @var mixed
35
	 * @access protected
36
	 */
37
	protected $userTypes = [
38
		0 => 'System',
39
		1 => 'Human',
40
		2 => 'Bot'
41
	];
42
	
43
	/**
44
	 * getUserTypeNameAttribute function.
45
	 * 
46
	 * @access public
47
	 * @return string
48
	 * @codeCoverageIgnore
49
	 */
50
	public function getUserTypeNameAttribute()
51
	{
52
		$typeid = isset($this->attributes['userTypeId']) ? $this->attributes['userTypeId'] : $this->attributes['userType'];
53
		return $this->userTypes[$typeid];
54
	}
55
	
56
	/**
57
	 * getLastUpdatedTimeAttribute function.
58
	 * 
59
	 * @access public
60
	 * @return \Carbon\Carbon
61
	 * @codeCoverageIgnore
62
	 */
63
	public function getLastUpdatedTimeAttribute()
64
	{
65
		return new Carbon($this->attributes['lastUpdatedTime']);
66
	}
67
	
68
	/**
69
	 * getCurrentStatusStartTimeAttribute function.
70
	 * 
71
	 * @access public
72
	 * @return \Carbon\Carbon
73
	 * @codeCoverageIgnore
74
	 */
75
	public function getCurrentStatusStartTimeAttribute()
76
	{
77
		return new Carbon($this->attributes['currentStatusStartTime']);
78
	}
79
	
80
	/**
81
	 * getCurrentStatusReasonStartTimeAttribute function.
82
	 * 
83
	 * @access public
84
	 * @return \Carbon\Carbon
85
	 * @codeCoverageIgnore
86
	 */
87
	public function getCurrentStatusReasonStartTimeAttribute()
88
	{
89
		return new Carbon($this->attributes['currentStatusReasonStartTime']);
90
	}
91
	
92
	/**
93
	 * getStatusMinutesAttribute function.
94
	 * 
95
	 * @access public
96
	 * @return float
97
	 * @codeCoverageIgnore
98
	 */
99
	public function getStatusMinutesAttribute()
100
	{
101
		return ($this->attributes['currentStatusDuration'] / 1000) / 60;
102
	}
103
	
104
	/**
105
	 * getAvatarAttribute function.
106
	 * 
107
	 * @access public
108
	 * @return string
109
	 * @codeCoverageIgnore
110
	 */
111
	public function getAvatarAttribute()
112
	{
113
		return isset($this->attributes['pictureUrl']) ? $this->attributes['pictureUrl'] : null;
114
	}
115
	
116
	/**
117
	 * getDetailsAttribute function.
118
	 * 
119
	 * @access public
120
	 * @return void
121
	 */
122
	public function getDetailsAttribute()
123
	{
124
		return \LiveEngage::getAgent($this->agentId);
0 ignored issues
show
Bug introduced by
The property agentId does not seem to exist on LivePersonInc\LiveEngageLaravel\Models\Agent. 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 type LiveEngage was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
125
	}
126
	
127
}