Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Naming conventions #17

Open
frankmullenger opened this issue Jul 2, 2012 · 2 comments
Open

Naming conventions #17

frankmullenger opened this issue Jul 2, 2012 · 2 comments
Labels
Milestone

Comments

@frankmullenger
Copy link

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
then
PayPal_Gateway extends Payment_Gateway
and
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_*
etc.

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.

@wilr
Copy link
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.

@frankmullenger
Copy link
Author

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
Labels
Projects
None yet
Development

No branches or pull requests

2 participants