Passed
Branch master (96b04a)
by Robert
03:20
created

Conversation   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 8
dl 0
loc 15
ccs 0
cts 9
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
B __construct() 0 11 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
	public function __construct(array $item)
16
	{
17
		$item['info'] = isset($item['info']) ? new MessagingInfo((array) $item['info']) : new MessagingInfo();
18
		$item['visitorInfo'] = isset($item['visitorInfo']) ? new Visitor((array) $item['visitorInfo']) : new Visitor();
19
		$item['campaign'] = isset($item['campaign']) ? new Campaign((array) $item['campaign']) : new Campaign();
20
		$item['transfers'] = new Transfers(isset($item['transfers']) ? $item['transfers'] : []);
21
		$item['agentParticipants'] = new AgentParticipants(isset($item['agentParticipants']) ? $item['agentParticipants'] : []);
22
		$item['consumerParticipants'] = new AgentParticipants(isset($item['consumerParticipants']) ? $item['consumerParticipants'] : []);
23
		$item['messageRecords'] = new Transcript(isset($item['messageRecords']) ? $item['messageRecords'] : []);
24
		
25
		parent::__construct($item);
26
	}
27
}
28