aboutsummaryrefslogtreecommitdiffstats
path: root/includes/TemplateParser.php
diff options
context:
space:
mode:
authorKunal Mehta <legoktm@gmail.com>2015-03-22 20:06:28 -0700
committerKunal Mehta <legoktm@gmail.com>2015-03-22 20:31:59 -0700
commit2f88829e1bc914e859be9ef270b3d657ee6a787b (patch)
tree8de651408876402e0482f1524d68b665cd3ae2ac /includes/TemplateParser.php
parentcfcaa33fcc424cd85444d71f10f6ce7cc2fb1e58 (diff)
downloadmediawikicore-2f88829e1bc914e859be9ef270b3d657ee6a787b.tar.gz
mediawikicore-2f88829e1bc914e859be9ef270b3d657ee6a787b.zip
TemplateParser: make most functions protected, only expose processTemplate()
All of the other functions expose internal implementation details, which no external caller should ever need. In fact, no external caller does use these functions directly. The TemplateParser::compile() tests were removed as they're simply just checking LightnCandy functionality, which is something the library should be doing. Change-Id: If9003d40315e0e5aa361c174b764b799e3b88c34
Diffstat (limited to 'includes/TemplateParser.php')
-rw-r--r--includes/TemplateParser.php10
1 files changed, 5 insertions, 5 deletions
diff --git a/includes/TemplateParser.php b/includes/TemplateParser.php
index 0131fe694553..b105ca493ca6 100644
--- a/includes/TemplateParser.php
+++ b/includes/TemplateParser.php
@@ -51,7 +51,7 @@ class TemplateParser {
* @return string
* @throws UnexpectedValueException Disallows upwards directory traversal via $templateName
*/
- public function getTemplateFilename( $templateName ) {
+ protected function getTemplateFilename( $templateName ) {
// Prevent upwards directory traversal using same methods as Title::secureAndSplit
if (
strpos( $templateName, '.' ) !== false &&
@@ -77,7 +77,7 @@ class TemplateParser {
* @return callable
* @throws RuntimeException
*/
- public function getTemplate( $templateName ) {
+ protected function getTemplate( $templateName ) {
// If a renderer has already been defined for this template, reuse it
if ( isset( $this->renderers[$templateName] ) && is_callable( $this->renderers[$templateName] ) ) {
return $this->renderers[$templateName];
@@ -145,9 +145,9 @@ class TemplateParser {
* @return string PHP code (without '<?php')
* @throws RuntimeException
*/
- public function compileForEval( $fileContents, $filename ) {
+ protected function compileForEval( $fileContents, $filename ) {
// Compile the template into PHP code
- $code = self::compile( $fileContents );
+ $code = $this->compile( $fileContents );
if ( !$code ) {
throw new RuntimeException( "Could not compile template: {$filename}" );
@@ -167,7 +167,7 @@ class TemplateParser {
* @return string PHP code (with '<?php')
* @throws RuntimeException
*/
- public static function compile( $code ) {
+ protected function compile( $code ) {
if ( !class_exists( 'LightnCandy' ) ) {
throw new RuntimeException( 'LightnCandy class not defined' );
}