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.
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?
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.
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?