Physikerwelt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/67445


Change subject: Fix: PHP Style corrections
......................................................................

Fix: PHP Style corrections

* Explicit function visibility
* Uniform constant definition

Change-Id: I5f064d2eac0dedd4c8cc94f442c65f0e338ebbf4
---
M MathTexvc.php
M tests/MathTexvcTest.php
2 files changed, 13 insertions(+), 13 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Math 
refs/changes/45/67445/1

diff --git a/MathTexvc.php b/MathTexvc.php
index 493e83a..16189ca 100644
--- a/MathTexvc.php
+++ b/MathTexvc.php
@@ -17,21 +17,21 @@
  * @author Brion Vibber
  * @author Moritz Schubotz
  */
-define( 'MW_TEXVC_SUCCESS', -1 );
 class MathTexvc extends MathRenderer {
        const CONSERVATIVE = 2;
        const MODERATE = 1;
        const LIBERAL = 0;
+       const MW_TEXVC_SUCCESS = -1;
 
        /**
         * Renders TeX using texvc
         *
         * @return string rendered TeK
         */
-       function render() {
+       public function render() {
                if ( !$this->readCache() ) { // cache miss
                        $result = $this->callTexvc();
-                       if ( $result != MW_TEXVC_SUCCESS ) {
+                       if ( $result != self::MW_TEXVC_SUCCESS ) {
                                return $result;
                        }
                }
@@ -43,7 +43,7 @@
         *
         * @return string Storage directory
         */
-       function getHashPath() {
+       public function getHashPath() {
                $path = $this->getBackend()->getRootStoragePath() .
                        '/math-render/' . $this->getHashSubPath();
                wfDebugLog("Math", "TeX: getHashPath, hash is: 
{$this->getHash()}, path is: $path\n" );
@@ -55,7 +55,7 @@
         *
         * @return string Relative directory
         */
-       function getHashSubPath() {
+       public function getHashSubPath() {
                return substr( $this->getHash(), 0, 1 )
                        . '/' . substr( $this->getHash(), 1, 1 )
                        . '/' . substr( $this->getHash(), 2, 1 );
@@ -66,7 +66,7 @@
         *
         * @return string image URL
         */
-       function getMathImageUrl() {
+       public function getMathImageUrl() {
                global $wgMathPath;
                $dir = $this->getHashSubPath();
                return "$wgMathPath/$dir/{$this->getHash()}.png";
@@ -77,7 +77,7 @@
         *
         * @return string img HTML
         */
-       function getMathImageHTML() {
+       public function getMathImageHTML() {
                $url = $this->getMathImageUrl();
 
                return Xml::element( 'img',
@@ -125,7 +125,7 @@
         *
         * @return int|string MW_TEXVC_SUCCESS or error string
         */
-       function callTexvc() {
+       public function callTexvc() {
                global $wgTexvc, $wgTexvcBackgroundColor, $wgUseSquid, 
$wgMathCheckFiles;
                $tmpDir = wfTempDir();
                if ( !is_executable( $wgTexvc ) ) {
@@ -228,7 +228,7 @@
                ) {
                        return $this->getError( 'math_output_error' );
                }
-               return MW_TEXVC_SUCCESS;
+               return self::MW_TEXVC_SUCCESS;
        }
 
        /**
@@ -236,7 +236,7 @@
         *
         * @return FileBackend appropriate file backend
         */
-       function getBackend() {
+       public function getBackend() {
                global $wgMathFileBackend, $wgMathDirectory;
                if ( $wgMathFileBackend ) {
                        return FileBackendGroup::singleton()->get( 
$wgMathFileBackend );
@@ -259,7 +259,7 @@
         *
         * @return string HTML string
         */
-       function doHTMLRender() {
+       public function doHTMLRender() {
                if ( $this->getMode() == MW_MATH_MATHML && $this->getMathml() 
!= '' ) {
                        return Xml::tags( 'math',
                                $this->getAttributes( 'math',
@@ -306,7 +306,7 @@
         *
         * @return boolean true if retrieved, false otherwise
         */
-       function readCache() {
+       public function readCache() {
                global $wgMathCheckFiles;
                if ( $this->readFromDatabase() ) {
                        if ( !$wgMathCheckFiles ) {
diff --git a/tests/MathTexvcTest.php b/tests/MathTexvcTest.php
index cb66951..c2c6229 100644
--- a/tests/MathTexvcTest.php
+++ b/tests/MathTexvcTest.php
@@ -74,7 +74,7 @@
                // ... on cache miss, MathTexvc will shell out to texvc:
                $texvc->expects( $this->once() )
                        ->method( 'callTexvc' )
-                       ->will( $this->returnValue( MW_TEXVC_SUCCESS ) );
+                       ->will( $this->returnValue( MathTexvc::MW_TEXVC_SUCCESS 
) );
 
                // ... if texvc succeeds, MathTexvc will generate HTML:
                $texvc->expects( $this->once() )

-- 
To view, visit https://gerrit.wikimedia.org/r/67445
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5f064d2eac0dedd4c8cc94f442c65f0e338ebbf4
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Math
Gerrit-Branch: master
Gerrit-Owner: Physikerwelt <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to