Passed
Push — 5.x ( 39b1e8...2ac3d7 )
by Jeroen
15:45 queued 13s
created

default/resources/friends/collections/view.php (1 issue)

Labels
Severity
1
<?php
2
/**
3
 * View a collection
4
 */
5
6
use Elgg\Exceptions\Http\EntityNotFoundException;
7
use Elgg\Exceptions\Http\EntityPermissionsException;
8
9
$collection_id = (int) elgg_extract('collection_id', $vars);
10
11
$collection = elgg_get_access_collection($collection_id);
12
if (!$collection instanceof \ElggAccessCollection || !$collection->canEdit()) {
13
	// We don't want to leak friendship/collection information
14
	throw new EntityPermissionsException();
15
}
16
17
$user = $collection->getOwnerEntity();
18
if (!$user instanceof \ElggUser) {
19
	throw new EntityNotFoundException();
20
}
21
22
elgg_set_page_owner_guid($user->guid);
23
24
elgg_push_breadcrumb(elgg_echo('friends:collections'), elgg_generate_url('collection:access_collection:friends:owner', ['username' => $user->username]));
1 ignored issue
show
It seems like elgg_generate_url('colle...e' => $user->username)) can also be of type null; however, parameter $href of elgg_push_breadcrumb() does only seem to accept false|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

24
elgg_push_breadcrumb(elgg_echo('friends:collections'), /** @scrutinizer ignore-type */ elgg_generate_url('collection:access_collection:friends:owner', ['username' => $user->username]));
Loading history...
25
26
echo elgg_view_page($collection->getDisplayName(), [
27
	'content' => elgg_view('collections/collection', [
28
		'full_view' => true,
29
		'item' => $collection,
30
	]),
31
	'filter_id' => 'friends_collections/view',
32
]);
33