Reduce calls to MediaWikiServices::getInstance()
[lhc/web/wiklou.git] / includes / logging / ProtectLogFormatter.php
index 9e5eea5..ba02457 100644 (file)
  * http://www.gnu.org/copyleft/gpl.html
  *
  * @file
- * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
+ * @license GPL-2.0-or-later
  * @since 1.26
  */
+
 use MediaWiki\MediaWikiServices;
 
 /**
@@ -78,7 +79,7 @@ class ProtectLogFormatter extends LogFormatter {
        }
 
        public function getActionLinks() {
-               $linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
+               $linkRenderer = $this->getLinkRenderer();
                $subtype = $this->entry->getSubtype();
                if ( $this->entry->isDeleted( LogPage::DELETED_ACTION ) // Action is hidden
                        || $subtype === 'move_prot' // the move log entry has the right action link
@@ -147,13 +148,13 @@ class ProtectLogFormatter extends LogFormatter {
        }
 
        public function formatParametersForApi() {
-               global $wgContLang;
-
                $ret = parent::formatParametersForApi();
                if ( isset( $ret['details'] ) && is_array( $ret['details'] ) ) {
+                       $contLang = MediaWikiServices::getInstance()->getContentLanguage();
                        foreach ( $ret['details'] as &$detail ) {
                                if ( isset( $detail['expiry'] ) ) {
-                                       $detail['expiry'] = $wgContLang->formatExpiry( $detail['expiry'], TS_ISO_8601, 'infinite' );
+                                       $detail['expiry'] = $contLang->
+                                               formatExpiry( $detail['expiry'], TS_ISO_8601, 'infinite' );
                                }
                        }
                }