[ 'name' => $gadget ] ] */ public function getStructuredList() { $list = []; foreach ( $this->getGadgetIds() as $id ) { try { $gadget = $this->getGadget( $id ); } catch ( InvalidArgumentException $e ) { continue; } $list[$gadget->getCategory()][$gadget->getName()] = $gadget; } return $list; } /** * Get the configured default GadgetRepo. * * @return GadgetRepo */ public static function singleton() { if ( self::$instance === null ) { global $wgGadgetsRepoClass; // @todo use Config here self::$instance = new $wgGadgetsRepoClass(); } return self::$instance; } /** * Should only be used by unit tests * * @param GadgetRepo|null $repo */ public static function setSingleton( $repo = null ) { self::$instance = $repo; } }