Closed geggleto closed 9 years ago
That can't be done in 3.1 as it'd be a BC break…
can you be a bit more specific, on whats your idea is?
@geggleto we need to know now what you are proposing otherwise its a 4.0 deal.
API Clean Up.
Currently we use the container to initialize all of the Slim dependencies.
I want to move this to a more object oriented design using Factories.
The 4 classes I listed have a hard-dependency on the Environment class with those static constructors, and it would be better a better design and make slim classes more adaptable. This goes with #1342
The constructors for some of these classes are extremely difficult to work with.
Example:
https://github.com/slimphp/Slim/blob/3.x/Slim/Http/Request.php#L169
public function __construct($method, UriInterface $uri, HeadersInterface $headers, array $cookies, array $serverParams, StreamInterface $body, array $uploadedFiles = [])
Ok, let me ask again: can you be a bit more specific on what your idea is?
What is the factory supposed to do exactly, and what is it supposed to be used for? because in the end the stuff in the constructor is what is needed, the environment is not hard required by the request itself, and there is a conveniance method that works as a factory for creating it fromEnvironment?
I think it would just be moving the Request::createFromEnvironment
to something like Environment::createRequest()
. Is that what you mean?
not sure how thats an improvement, and i doubt thats what he means ;)
2015-09-21 16:45 GMT+02:00 Martijn Wennink notifications@github.com:
I think it would just be moving the Request::createFromEnvironment to something like Environment::createRequest(). Is that what you mean?
— Reply to this email directly or view it on GitHub https://github.com/slimphp/Slim/issues/1500#issuecomment-142003570.
Peter Petermann ProtonMail: ppetermann@protonmail.com (encrypted / based in .ch) Email: ppetermann80@gmail.com - get my public PGP key from SKS Keyservers PGP Key: http://pool.sks-keyservers.net:11371/pks/lookup?op=get&search=0x0E6DBD675836A5C7
We spoke and will tend to this later once @geggleto work out what he wants to say.
This can wait for 3.1.
After reviewing the source code, I think we need to move some of the construction code around. There are many classes that have static constructors
createFromEnvironment
: Uri, UploadedFile, Request, Headers,We should have those refactored into the Environment Class turning it into a Factory.