Engagement::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 17
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 9
CRAP Score 1

Importance

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