Skip to content

Naming conventions #17

frankmullenger opened this Issue Jul 2, 2012 · 2 comments

2 participants


We should discuss naming conventions a little bit and aim to have them tidied up for mid term. At the moment we have things like:

Payment_Gateway living in Gateway.php
PayPal_Gateway extends Payment_Gateway
PayPalDirect_Gateway extends PayPal_Gateway
PayPalExpress_Gateway "

DummyGatewayHosted_Gateway extends Payment_Gateway
DummyMerchantHosted_Gateway extends Payment_Gateway

I think it would be best to try and stick to the convention of filename being the prefix for the class names in that file e.g:

PaymentGateway.php has classes PaymentGateway_*
PayPal.php has classes PayPal_*

I'm also happy to reconsider naming Payment_Controller to PaymentProcessor and for consistency maybe we should have
Payment.php -> Payment
PaymentGateway.php -> PaymentGateway
PaymentProcessor.php -> PaymentProcessor

And perhaps adding another class to encapsulate the model/controller/gateway instantiation instead of using a static factory method like:
PaymentFactory.php -> PaymentFactory

Which could take care of retrieving supported payment methods and creating the payment controller with model and gateway injected.

SilverStripe Labs member
wilr commented Jul 7, 2012

If you're thinking about making payment support 3.0 only I'd also suggest looking into PHP namespaces. We haven't made much use of them in core yet but 3.1 will use them.


Cheers Will, good to know. We'll start looking into namespaces soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.