mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/CategoryTree
synced 2024-11-27 09:43:06 +00:00
Remove duplicate/unnecessary trim
CategoryTree::makeTitle also makes a trim and an early return. A trim on the return value of renderChildren() is not needed. Change-Id: I1fc2705277491797eb6c0d0900152b63913ca875
This commit is contained in:
parent
921e6fe3f9
commit
092797b0e2
|
@ -147,7 +147,7 @@ class ApiCategoryTree extends ApiBase {
|
||||||
),
|
),
|
||||||
$this->wanCache::TTL_DAY,
|
$this->wanCache::TTL_DAY,
|
||||||
static function () use ( $ct, $title, $depth ) {
|
static function () use ( $ct, $title, $depth ) {
|
||||||
return trim( $ct->renderChildren( $title, $depth ) );
|
return $ct->renderChildren( $title, $depth );
|
||||||
},
|
},
|
||||||
[
|
[
|
||||||
'touchedCallback' => function () {
|
'touchedCallback' => function () {
|
||||||
|
|
|
@ -81,14 +81,8 @@ class CategoryTree {
|
||||||
public function getTag( string $category, bool $hideroot = false, array $attr = [],
|
public function getTag( string $category, bool $hideroot = false, array $attr = [],
|
||||||
int $depth = 1
|
int $depth = 1
|
||||||
) {
|
) {
|
||||||
$category = trim( $category );
|
|
||||||
if ( $category === '' ) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
$title = self::makeTitle( $category );
|
$title = self::makeTitle( $category );
|
||||||
|
if ( !$title ) {
|
||||||
if ( $title === null ) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue