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

Parameter definition and accessibility #237

Closed
cloudcogsio opened this issue Dec 11, 2020 · 0 comments
Closed

Parameter definition and accessibility #237

cloudcogsio opened this issue Dec 11, 2020 · 0 comments

Comments

@cloudcogsio
Copy link

cloudcogsio commented Dec 11, 2020

  1. Parameter definition and accessibility
    I'm in the process of writing a driver for gateway, however I've found that the need to duplicate the parameter setter and getter methods in both AbstractGateway and AbstractRequest classes to be cumbersome.

Surely there must be a better way to make default parameters and those defined on the Gateway class accessible to the Message classes without having to redefine those methods.

Example:
If I need a parameter 'foo', I must define a 'setFoo()' and 'getFoo()' on both AbstractGateway and AbstractRequest classes.
If I only define them on the AbstractGateway class, 'foo' is not passed to the AbstractRequest class parameters.

Additionally I would suggest a move to a configuration based model for defining parameters. This would eliminate the need to explicitly define setters and getters methods for parameters, which arguably may not be feasible for a use case that may require many parameters.

  1. Parameters with Array values.
    I defined a parameter with an array as the value but when the parameters were initialized, the parameter ended up having the first element of the array as the assigned value. The other values in the original array that I need are lost.

Example:
public function getDefaultParameters()
{
return[
'supportedCurrencies' => ['USD','CAD'],
];
}

$GW->getParameter('supportedCurrencies'); // result is 'USD' when I expected the original array the was defined.

Is there a coding standard or some other reason for this approach to parameter handling?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant