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

views/default/user/default.php (1 issue)

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

Bug Minor
1
<?php
2
/**
3
 * Elgg user display
4
 *
5
 * @uses $vars['entity'] ElggUser entity
6
 * @uses $vars['size']   Size of the icon
7
 * @uses $vars['title']  Optional override for the title
8
 */
9
10
$entity = elgg_extract('entity', $vars);
11
if (!($entity instanceof ElggUser)) {
12
	return;
13
}
14
15
$size = elgg_extract('size', $vars, 'small');
16
$icon = elgg_view_entity_icon($entity, $size, $vars);
17
18
if (elgg_get_context() == 'gallery') {
19
	echo $icon;
20
	return;
21
}
22
	
23
$title = elgg_extract('title', $vars);
24
if (!$title) {
25
	$title = elgg_view('output/url', [
26
		'href' => $entity->getUrl(),
27
		'text' => $entity->getDisplayName(),
28
	]);
29
}
30
31
if ($entity->isBanned()) {
32
	$params = [
33
		'entity' => $entity,
34
		'title' => $title,
35
		'subtitle' => elgg_echo('banned'),
36
	];
37
} else {
38
	$subtitle = '';
39
	$location = $entity->location;
40
	if (is_string($location) && $location !== '') {
41
		$location = elgg_view_icon('map-marker') . ' ' . $location;
42
		$subtitle .= elgg_format_element('div', [], $location);
43
	}
44
	
45
	$subtitle .= elgg_format_element('div', [], $entity->briefdescription);
0 ignored issues
show
It seems like $entity->briefdescription can also be of type array; however, parameter $text of elgg_format_element() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

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

45
	$subtitle .= elgg_format_element('div', [], /** @scrutinizer ignore-type */ $entity->briefdescription);
Loading history...
46
	
47
	$params = [
48
		'entity' => $entity,
49
		'title' => $title,
50
		'subtitle' => $subtitle,
51
		'content' => elgg_view('user/status', ['entity' => $entity]),
52
	];
53
}
54
55
$params = $params + $vars;
56
57
$list_body = elgg_view('user/elements/summary', $params);
58
59
echo elgg_view_image_block($icon, $list_body);
60