Removed EncapsulatedOptions parameter from Connector::fetch method. #48
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Stop passing
EncapsulatedOptionsaround in method calls, instead tying them to theirConnectorimplementation. This makes sense because connectors have a 1:1 relationship with their options. That is, different options cannot be used with different connectors.To make connectors and their options immutable during import, connectors are now cloned in
Porter::fetch()and connectors exporting options must implement__clone()to deep clone their options. This addresses a dormant bug that failed to ensure connector options were immutable during import.The new interface,
ConnectorOptionsmust be implemented by connectors wishing to export options to ensure caching works correctly and to ensure Porter checks the connector implements the__clonemethod, which could not be specified in the interface due to a limitation in the mocking framework we're currently using (see mockery/mockery#669).ProviderOptionshas been completely removed because this made no sense. A providers only responsibility is to serve an appropriate connector for the specified resource, not to modify the connector or its configuration, which it couldn't even do without making assumptions about the connector's type, which it shouldn't do either. Implementations previously using this pattern should instead configure the connector properly before it's injected into the provider. Any methods for manipulating connector options implemented in the provider should be implemented in the connector instead.