mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/CategoryTree
synced 2024-11-27 17:51:00 +00:00
Merge "Simplify CategoryTree::capDepth"
This commit is contained in:
commit
6cba244a94
|
@ -802,7 +802,6 @@ class CategoryTree {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Internal function to cap depth
|
* Internal function to cap depth
|
||||||
* @suppress PhanPluginDuplicateConditionalNullCoalescing until PHP7 is required
|
|
||||||
* @param string $mode
|
* @param string $mode
|
||||||
* @param int $depth
|
* @param int $depth
|
||||||
* @return int|mixed
|
* @return int|mixed
|
||||||
|
@ -810,14 +809,14 @@ class CategoryTree {
|
||||||
public static function capDepth( $mode, $depth ) {
|
public static function capDepth( $mode, $depth ) {
|
||||||
global $wgCategoryTreeMaxDepth;
|
global $wgCategoryTreeMaxDepth;
|
||||||
|
|
||||||
if ( is_numeric( $depth ) ) {
|
if ( !is_numeric( $depth ) ) {
|
||||||
$depth = intval( $depth );
|
|
||||||
} else {
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$depth = intval( $depth );
|
||||||
|
|
||||||
if ( is_array( $wgCategoryTreeMaxDepth ) ) {
|
if ( is_array( $wgCategoryTreeMaxDepth ) ) {
|
||||||
$max = isset( $wgCategoryTreeMaxDepth[$mode] ) ? $wgCategoryTreeMaxDepth[$mode] : 1;
|
$max = $wgCategoryTreeMaxDepth[$mode] ?? 1;
|
||||||
} elseif ( is_numeric( $wgCategoryTreeMaxDepth ) ) {
|
} elseif ( is_numeric( $wgCategoryTreeMaxDepth ) ) {
|
||||||
$max = $wgCategoryTreeMaxDepth;
|
$max = $wgCategoryTreeMaxDepth;
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue