From f7eede1191c89b5222b64090de1e85d1d56db325 Mon Sep 17 00:00:00 2001 From: Derick Alangi Date: Sat, 14 Sep 2019 11:26:31 +0100 Subject: [PATCH] OutputPage: Add visibility to various methods & do some micro-optimizations Methods that visibility was added to are; `addMeta()`, `addLink()`, `setCanonicalUrl()`, `addScript()`, `getHeadItemsArray()`, `addParserOutput()`, `getCacheVaryCookies()` and `haveCacheVaryCookies()`. Last but not lease, did a few micro-optimizations to `addMeta()` and `addLink()`. Change-Id: I94d037a5edc7131627724fd1d864000128077b0c --- includes/OutputPage.php | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/includes/OutputPage.php b/includes/OutputPage.php index 9dbbf139de..5359444e1d 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -332,7 +332,7 @@ class OutputPage extends ContextSource { * a OutputPage tied to that context. * @param IContextSource $context */ - function __construct( IContextSource $context ) { + public function __construct( IContextSource $context ) { $this->setContext( $context ); } @@ -385,8 +385,8 @@ class OutputPage extends ContextSource { * @param string $name Name of the meta tag * @param string $val Value of the meta tag */ - function addMeta( $name, $val ) { - array_push( $this->mMetatags, [ $name, $val ] ); + public function addMeta( $name, $val ) { + $this->mMetatags[] = [ $name, $val ]; } /** @@ -406,8 +406,8 @@ class OutputPage extends ContextSource { * * @param array $linkarr Associative array of attributes. */ - function addLink( array $linkarr ) { - array_push( $this->mLinktags, $linkarr ); + public function addLink( array $linkarr ) { + $this->mLinktags[] = $linkarr; } /** @@ -425,7 +425,7 @@ class OutputPage extends ContextSource { * in preference to addLink(), to avoid duplicate link tags. * @param string $url */ - function setCanonicalUrl( $url ) { + public function setCanonicalUrl( $url ) { $this->mCanonicalUrl = $url; } @@ -447,7 +447,7 @@ class OutputPage extends ContextSource { * * @param string $script Raw HTML */ - function addScript( $script ) { + public function addScript( $script ) { $this->mScripts .= $script; } @@ -621,7 +621,7 @@ class OutputPage extends ContextSource { * * @return array */ - function getHeadItemsArray() { + public function getHeadItemsArray() { return $this->mHeadItems; } @@ -1954,7 +1954,7 @@ class OutputPage extends ContextSource { * @param ParserOutput $parserOutput * @param array $poOptions Options to ParserOutput::getText() */ - function addParserOutput( ParserOutput $parserOutput, $poOptions = [] ) { + public function addParserOutput( ParserOutput $parserOutput, $poOptions = [] ) { $this->addParserOutputMetadata( $parserOutput ); $this->addParserOutputText( $parserOutput, $poOptions ); } @@ -2188,7 +2188,7 @@ class OutputPage extends ContextSource { * * @return array */ - function getCacheVaryCookies() { + public function getCacheVaryCookies() { if ( self::$cacheVaryCookies === null ) { $config = $this->getConfig(); self::$cacheVaryCookies = array_values( array_unique( array_merge( @@ -2209,7 +2209,7 @@ class OutputPage extends ContextSource { * * @return bool */ - function haveCacheVaryCookies() { + public function haveCacheVaryCookies() { $request = $this->getRequest(); foreach ( $this->getCacheVaryCookies() as $cookieName ) { if ( $request->getCookie( $cookieName, '', '' ) !== '' ) { -- 2.20.1