Passed
Push — master ( b19e1a...9e97df )
by Robert
03:55
created

Engagement::__construct()   B

Complexity

Conditions 5
Paths 8

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 5

Importance

Changes 0
Metric Value
dl 0
loc 8
ccs 6
cts 6
cp 1
rs 8.8571
c 0
b 0
f 0
cc 5
eloc 5
nc 8
nop 1
crap 5
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 2
	public function __construct(array $item)
16
	{
17 2
		$item['info'] = isset($item['info']) ? new Info((array) $item['info']) : new Info();
18 2
		$item['visitorInfo'] = isset($item['visitorInfo']) ? new Visitor((array) $item['visitorInfo']) : new Visitor();
19 2
		$item['campaign'] = isset($item['campaign']) ? new Campaign((array) $item['campaign']) : new Campaign();
20 2
		$item['transcript'] = new Transcript(isset($item['transcript']) ? $item['transcript']->lines : []);
21
22 2
		parent::__construct($item);
23 2
	}
24
}
25