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

Conversation::__construct()   B

Complexity

Conditions 8
Paths 8

Size

Total Lines 11
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 9
CRAP Score 8

Importance

Changes 0
Metric Value
dl 0
loc 11
ccs 9
cts 9
cp 1
rs 7.7777
c 0
b 0
f 0
cc 8
eloc 8
nc 8
nop 1
crap 8
1
<?php
2
3
namespace LivePersonInc\LiveEngageLaravel\Models;
4
5
use Illuminate\Database\Eloquent\Model;
6
use LivePersonInc\LiveEngageLaravel\Collections\AgentParticipants;
7
use LivePersonInc\LiveEngageLaravel\Collections\ConsumerParticipants;
8
use LivePersonInc\LiveEngageLaravel\Collections\Transfers;
9
use LivePersonInc\LiveEngageLaravel\Collections\Transcript;
10
11
class Conversation extends Model
12
{
13
	protected $guarded = [];
14
	
15 2
	public function __construct(array $item)
16
	{
17 2
		$item['info'] = isset($item['info']) ? new MessagingInfo((array) $item['info']) : new MessagingInfo();
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['transfers'] = new Transfers(isset($item['transfers']) ? $item['transfers'] : []);
21 2
		$item['agentParticipants'] = new AgentParticipants(isset($item['agentParticipants']) ? $item['agentParticipants'] : []);
22 2
		$item['consumerParticipants'] = new ConsumerParticipants(isset($item['consumerParticipants']) ? $item['consumerParticipants'] : []);
23 2
		$item['messageRecords'] = new Transcript(isset($item['messageRecords']) ? $item['messageRecords'] : []);
24
		
25 2
		parent::__construct($item);
26 2
	}
27
}
28