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

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

Labels
Severity
1
<?php
2
/**
3
 * Edit an existing 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
$collection = elgg_get_access_collection($collection_id);
11
12
if (!$collection || !$collection->canEdit()) {
13
	throw new EntityPermissionsException();
14
}
15
16
$user = $collection->getOwnerEntity();
17
if (!$user instanceof \ElggUser) {
18
	throw new EntityNotFoundException();
19
}
20
21
elgg_set_page_owner_guid($user->guid);
22
23
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

23
elgg_push_breadcrumb(elgg_echo('friends:collections'), /** @scrutinizer ignore-type */ elgg_generate_url('collection:access_collection:friends:owner', ['username' => $user->username]));
Loading history...
24
elgg_push_breadcrumb($collection->getDisplayName(), $collection->getURL());
25
26
echo elgg_view_page(elgg_echo('friends:collections:edit'), [
27
	'content' => elgg_view_form('friends/collections/edit', ['sticky_enabled' => true], [
28
		'collection_id' => $collection->id,
29
		'collection_name' => $collection->name,
30
	]),
31
	'filter_id' => 'friends_collections/edit',
32
]);
33