You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you want to construct your own "HttpLayer" (i.e. to re-use existing HTTP Client etc), you need to explicitly pass in the options array including the API key. This is undocumented. In fact, the main client interface "MailerLite" checks the options array given to the constructor for the api key, and throws an exception if it's not present, and then never uses it internally, assuming that the HttpLayer will be constructed internally and not passed as a constructor argument. It would make more sense to check for the presence of the api key inside the 'HttpLayer' and throw an exception there.
Adding an array shape to the constructors of both would be helpful, for example:
Summary
If you want to construct your own "HttpLayer" (i.e. to re-use existing HTTP Client etc), you need to explicitly pass in the options array including the API key. This is undocumented. In fact, the main client interface "MailerLite" checks the options array given to the constructor for the api key, and throws an exception if it's not present, and then never uses it internally, assuming that the
HttpLayer
will be constructed internally and not passed as a constructor argument. It would make more sense to check for the presence of the api key inside the 'HttpLayer' and throw an exception there.Adding an array shape to the constructors of both would be helpful, for example:
Expected Results
Not providing a valid API Key to
HttpLayer::__construct()
should throw an exceptionActual Results
PHP Notice: undefined index 'api_key'
Steps to Reproduce
The text was updated successfully, but these errors were encountered: