lib: Reduce else { if { to elseif { in User::can()

This commit is contained in:
Eric Lippmann 2015-01-30 11:20:05 +01:00
parent 127ce7abfe
commit e5b0b52874
1 changed files with 5 additions and 7 deletions

View File

@ -426,13 +426,11 @@ class User
foreach ($this->permissions as $permitted) { foreach ($this->permissions as $permitted) {
$wildcard = strpos($permitted, '*'); $wildcard = strpos($permitted, '*');
if ($wildcard !== false) { if ($wildcard !== false) {
if (substr($permission, 0, $wildcard) === substr($permitted, 0, $wildcard)) { }
return true; if (substr($permission, 0, $wildcard) === substr($permitted, 0, $wildcard)) {
} else { return true;
if ($permission === $permitted) { } elseif ($permission === $permitted) {
return true; return true;
}
}
} }
} }
return false; return false;