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
Then in constructor we create default classes because in majority of cases they won't be replaced.
We need to find a solution, that would:
allow user to override any dependency only when he/she needs it
prevent BC break (new mandatory constructor argument = bc break), when new dependency is added
avoid requiring developer from setting dependencies in specific order (in Add page matcher #124 the MatcherRegistry depends on Session+AnnotationManager, which is also what PageFactory needs)
don't force user to write lots of boilerplate code to create PageFactory (that most likely will happen with Builder pattern usage)
avoid using DIC because that would make new dependency for the library itself, which can conflict with other dependencies of a project that will use the library
Some crazy implementation idea: since all PageFactory dependencies are objects we can:
take all constructor arguments via func_get_args()
determine which one is which by their class
set dependency to PageFactory
set missing dependencies to defaults
remove setter methods that currently allow to replace dependencies in the middle of PageFactory usage which results in some stale objects (e.g. session) sitting in objects that were created by PageFactory
The text was updated successfully, but these errors were encountered:
Currently it works like so:
PageFactory
class has mandatory$session
parameter and optional$config
parameterAnnotationManager
,UrlFactory
,Normalizer
,DefaultPageLocator
Then in constructor we create default classes because in majority of cases they won't be replaced.
We need to find a solution, that would:
Some crazy implementation idea: since all PageFactory dependencies are objects we can:
func_get_args()
The text was updated successfully, but these errors were encountered: