2Checkout / 2checkout-php

2Checkout PHP Library
MIT License
83 stars 66 forks source link

2 Enhancements #1

Open dominoe opened 11 years ago

dominoe commented 11 years ago

2 Enhancements so far:

1) If you don't use the class "TwocheckoutCharge", why loading it? I recommend using autoload register, ie:

"""" spl_autoload_register(function($X){switch($X){

case 'Twocheckout_Company': require(dirname(FILE) . '/Twocheckout/Api/TwocheckoutAccount.php'); case 'Twocheckout_Payment': require(dirname(FILE) . '/Twocheckout/Api/TwocheckoutPayment.php'); .... ..... ..... case '...'.... break;

}}); """"

This will provide performance since the class extensions are only loaded if the class is being called.

2) Consider using singles quotes for text only: this

" form id=\"2checkout\" action=\"https://www.2checkout.com/checkout/spurchase\" method=\"post\" "

to this

.....' form id="2checkout" action="https://www.2checkout.com/checkout/spurchase" method="post" '.....

double quotes always checks variables inside, the single parses it directly.

I hope this was helpful. I'm new to both github and 2checkout. If I find anything else I'll tell you.

craigchristenson commented 11 years ago

Thanks for taking the time to open an issue dominoe. I'll try out the suggestions and get them up in a branch for the next version.