ConsumerParticipants::__construct()   A
last analyzed

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 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 8
ccs 5
cts 5
cp 1
rs 10
cc 2
nc 1
nop 1
crap 2
1
<?php
2
/**
3
 * ConsumerParticipants is a collection of visitor objects
4
 *
5
 * @package LivePersonInc\LiveEngageLaravel\Collections
6
 */
7
8
namespace LivePersonInc\LiveEngageLaravel\Collections;
9
10
use Illuminate\Support\Collection;
11
use LivePersonInc\LiveEngageLaravel\Models\Visitor;
12
use LivePersonInc\LiveEngageLaravel\Models\MetaData;
13
14
/**
15
 * ConsumerParticipants class.
16
 * 
17
 * @extends Collection
18
 */
19
class ConsumerParticipants extends Collection
20
{
21
	/**
22
	 * metaData
23
	 * 
24
	 * @var \LivePersonInc\LiveEngageLaravel\Models\MetaData
25
	 * @access public
26
	 */
27
	public $metaData;
28
	
29
	/**
30
	 * __construct function.
31
	 * 
32
	 * @access public
33
	 * @param array $models (default: [])
34
	 * @return void
35
	 */
36 1
	public function __construct(array $models = [])
37
	{
38
		
39
		$models = array_map(function($item) {
40 1
			return is_a($item, 'LivePersonInc\LiveEngageLaravel\Models\Visitor') ? $item : new Visitor((array) $item);
41 1
		}, $models);
42 1
		$this->metaData = new MetaData();
43 1
		parent::__construct($models);
44 1
	}
45
}
46