Simplify the code / check number of parameters in mergeConditions
This commit is contained in:
parent
8d0d6bcd0c
commit
4852458645
2 changed files with 5 additions and 5 deletions
|
@ -669,6 +669,10 @@ class DBA
|
||||||
*/
|
*/
|
||||||
public static function mergeConditions(array ...$conditions)
|
public static function mergeConditions(array ...$conditions)
|
||||||
{
|
{
|
||||||
|
if (count($conditions) == 1) {
|
||||||
|
return current($conditions);
|
||||||
|
}
|
||||||
|
|
||||||
$conditionStrings = [];
|
$conditionStrings = [];
|
||||||
$result = [];
|
$result = [];
|
||||||
|
|
||||||
|
|
|
@ -201,11 +201,7 @@ class Item
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($condition)) {
|
|
||||||
$condition = DBA::mergeConditions(['iid' => $pinned], $condition);
|
$condition = DBA::mergeConditions(['iid' => $pinned], $condition);
|
||||||
} else {
|
|
||||||
$condition = ['iid' => $pinned];
|
|
||||||
}
|
|
||||||
|
|
||||||
return self::selectThreadForUser($uid, $selected, $condition, $params);
|
return self::selectThreadForUser($uid, $selected, $condition, $params);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue