Skip to content
This repository has been archived by the owner on Dec 30, 2022. It is now read-only.

Introduce Configuration #27

Open
dropdevcoding opened this issue Dec 3, 2016 · 0 comments
Open

Introduce Configuration #27

dropdevcoding opened this issue Dec 3, 2016 · 0 comments

Comments

@dropdevcoding
Copy link
Contributor

Currently we use protected methods to return the relevant middlewares adroit consists of and works on.
Due to this, you would have to inherit AdroitMiddleware to change that behavior / the used classes.
Imho the better approach would be to inject that middlewares by passing a Configuration instance to Adroit.

Configuration should:

  • have a protected constructor
  • provide a factory method Configuration::withDefaults() and which returns a Configuration with exactly the middlewares currently used by Adroit
  • have immutable methods which return a new instance having defined the new middleware (e.g. $configuration->withActionExecutorMiddleware)
  • should expose the current protected static attributes of adroit as public statics to enable reusage in own configuration since the constructors signatures may look different

Adroit then should:

  • have a protected constructor
  • only offer a factory method Adroit::create(Configuration $config = null)
  • use $this->config = Configuration::withDefaults() no config is given
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant