Passed
Branch master (ac8b07)
by Robert
03:36
created

Engagement::__construct()   B

Complexity

Conditions 5
Paths 16

Size

Total Lines 18
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 30

Importance

Changes 0
Metric Value
dl 0
loc 18
ccs 0
cts 10
cp 0
rs 8.8571
c 0
b 0
f 0
cc 5
eloc 9
nc 16
nop 1
crap 30
1
<?php
2
3
namespace LivePersonInc\LiveEngageLaravel\Models;
4
5
use Illuminate\Database\Eloquent\Model;
6
use LivePersonInc\LiveEngageLaravel\Collections\Transcript;
7
8
class Engagement extends Model
9
{
10
	protected $guarded = [];
11
	protected $appends = [
12
		'transcript',
13
	];
14
	
15
	public function __construct(array $item)
16
	{
17
		if (isset($item['info'])) {
18
			$item['info'] = new Info((array) $item['info']);
19
		}
20
21
		if (isset($item['visitorInfo'])) {
22
			$item['visitorInfo'] = new Visitor((array) $item['visitorInfo']);
23
		}
24
25
		if (isset($item['campaign'])) {
26
			$item['campaign'] = new Campaign((array) $item['campaign']);
27
		}
28
		
29
		if (isset($item['transcript'])) {
30
			$item['transcript'] = new Transcript((array) $item['transcript']);
31
		}
32
		parent::__construct($item);
33
	}
34
}
35