@sebastianpiskorski opened this issue on June 26th 2015

Please extend Location provider https://github.com/piwik/piwik/blob/2.13.1/plugins/UserCountry/LocationProvider.php by method getInfo() which returns Info object that contains getTitle() method.

It was used in EnterpriseAdmin in such manner: https://github.com/PiwikPRO/plugin-EnterpriseAdmin/blob/2.1.0/Commands/Status.php#L237

So without assurance that returned object will have getInfo method, command was dying with error.

@mattab commented on July 15th 2015

Hi @sebastianpiskorski

I didn't quite do as you suggested, but simply changed getProvider() signature to return null instead of false, when the provider is invalid. This way we can simply test for !is_null or !empty to check the object is valid before use. it should be good enough for our needs, thanks for suggestion!

@sebastianpiskorski commented on July 21st 2015

@mattab I think that if we are using an instance of LocationProvider object we should only use methods that are defined in its interface. So we would avoid fatal errors. So if we want to use getInfo() method we should extend LocationProvider interface first.

This issue was closed on July 15th 2015
Powered by GitHub Issue Mirror