Passed
Push — master ( c0a3a7...3b84a4 )
by Jeroen
58:51
created

views/default/collections/members.php (1 issue)

Checks if the types of the passed arguments in a function/method call are compatible.

Bug Minor
1
<?php
2
3
/**
4
 * List members of a collection
5
 *
6
 * @uses $vars['collection'] Access collection
7
 */
8
$collection = elgg_extract('collection', $vars);
9
if (!$collection instanceof ElggAccessCollection) {
10
	return;
11
}
12
13
$offset_key = "col_{$collection->id}";
14
$offset = get_input($offset_key, 0);
15
$limit = max(20, elgg_get_config('default_limit'));
16
17
$members = $collection->getMembers([
18
	'limit' => $limit,
19
	'offset' => $offset,
20
]);
21
22
if ($members) {
23
	foreach ($members as $member) {
24
		// We set volatile data, so that we can use the default user listing
25
		// and modify the entity menu
26
		$member->setVolatileData('friends:collection', $collection);
27
	}
28
}
29
30
$count = $collection->getMembers([
31
	'count' => true,
32
]);
33
34
echo elgg_view_entity_list($members, [
0 ignored issues
show
$members of type false is incompatible with the type array expected by parameter $entities of elgg_view_entity_list(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

34
echo elgg_view_entity_list(/** @scrutinizer ignore-type */ $members, [
Loading history...
35
	'count' => $count,
36
	'limit' => $limit,
37
	'offset' => $offset,
38
	'offset_key' => $offset_key,
39
	'collection' => $collection,
40
	'no_results' => elgg_echo('friends:collection:members:no_results'),
41
]);
42