Please note that it is intentional that there is no getter in this class. I want OOPS to promote SOLID principles and dependency injection. If one of your services requires access to another service, that should be established by passing one object into another through some method or the Service constructor. That said, you're right that by caching the instantiated services to the class property, you'll be able to access those instances where needed. The run property is public and the register_services method is protected, so a concrete class can easily override this initialization procedure if there's a particular use case for it.
Closes #11
@aubreypwd Here's a PR for you. This follows the process I'm using else where an array of services such as:
...becomes an array like:
Please note that it is intentional that there is no getter in this class. I want OOPS to promote SOLID principles and dependency injection. If one of your services requires access to another service, that should be established by passing one object into another through some method or the Service constructor. That said, you're right that by caching the instantiated services to the class property, you'll be able to access those instances where needed. The
run
property is public and theregister_services
method is protected, so a concrete class can easily override this initialization procedure if there's a particular use case for it.Let me know if you have any questions.