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

ConsumerParticipants::__construct()   A

Complexity

Conditions 2
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 8
ccs 5
cts 5
cp 1
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 5
nc 1
nop 1
crap 2
1
<?php
2
3
namespace LivePersonInc\LiveEngageLaravel\Collections;
4
5
use Illuminate\Support\Collection;
6
use LivePersonInc\LiveEngageLaravel\Models\Visitor;
7
use LivePersonInc\LiveEngageLaravel\Models\MetaData;
8
9
class ConsumerParticipants extends Collection
10
{
11
	public $metaData;
12
	
13 1
	public function __construct(array $models = [])
14
	{
15
		
16
		$models = array_map(function($item) {
17 1
			return is_a($item, 'LivePersonInc\LiveEngageLaravel\Models\Visitor') ? $item : new Visitor((array) $item);
18 1
		}, $models);
19 1
		$this->metaData = new MetaData();
20 1
		parent::__construct($models);
21 1
	}
22
}
23