Cdentinger has uploaded a new change for review.

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

Change subject: use config array in gateway_common
......................................................................

use config array in gateway_common

Change-Id: I5d8ea353b8259a083b26387449751811eaf8a62e
TODO: adapter->payment_(sub)methods can go away now
---
M gateway_common/gateway.adapter.php
1 file changed, 14 insertions(+), 4 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/DonationInterface 
refs/changes/01/278201/1

diff --git a/gateway_common/gateway.adapter.php 
b/gateway_common/gateway.adapter.php
index ecef421..9800d78 100644
--- a/gateway_common/gateway.adapter.php
+++ b/gateway_common/gateway.adapter.php
@@ -31,6 +31,12 @@
 abstract class GatewayAdapter implements GatewayType, LogPrefixProvider {
 
        /**
+        * Tree of config.
+        * TODO: move things here
+        */
+       protected $config = array();
+
+       /**
         * $dataConstraints provides information on how to handle variables.
         *
         *       <code>
@@ -295,17 +301,21 @@
                return $this->request;
        }
 
-       public function definePaymentMethods() {
+       public function readConfig() {
                $yaml = new Parser();
                foreach ( glob( $this->getBasedir() . "/config/*.yaml" ) as 
$path ) {
                        $pieces = explode( "/", $path );
                        $key = substr( array_pop( $pieces ), 0, -5 );
-                       # TODO should put this in structured config rather than 
a member
-                       # variable, but this plays along with the current code.
-                       $this->$key = $yaml->parse( file_get_contents( $path ) 
);
+                       $this->config[$key] = $yaml->parse( file_get_contents( 
$path ) );
                }
        }
 
+       // TODO: deprecate me, use an accessor
+       public function definePaymentMethods() {
+               $this->payment_methods = $this->config['payment_methods'];
+               $this->payment_submethod = $this->config['payment_submethods'];
+       }
+
        /**
         * Determine which account to use for this session
         */

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5d8ea353b8259a083b26387449751811eaf8a62e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/DonationInterface
Gerrit-Branch: master
Gerrit-Owner: Cdentinger <cdentin...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to