Task: Implement the Slim\Middleware base class to enable middleware chaining and application binding used by the tests.
What to implement
Create a minimal Slim\Middleware base class that the test's My_Middleware can extend.
Provide the necessary properties and methods to support the tests:
A protected property to hold the next middleware in the chain.
A protected property to hold the bound application instance.
Public methods:
setNextMiddleware($next)
getNextMiddleware()
setApplication($application)
getApplication()
Do not implement the call() behavior in the base class; the test defines a subclass that overrides call() and uses $this->next->call(), so the base must supply the next reference mechanism and application binding.
Ensure compatibility with PHP 5.x (no PHP 7+ syntax requirements).
Exact requirements
File path: /app/Slim/Middleware.php
Namespace: Slim
Class: Middleware
Properties:
protected $next;
protected $application;
Methods:
public function setNextMiddleware($next)
Sets the next middleware in the chain.
public function getNextMiddleware()
Returns the next middleware object.
public function setApplication($application)
Binds an application object to this middleware.
public function getApplication()
Returns the bound application object.
The class should be minimal and not interfere with the subclass’s call() behavior defined in the tests.
Notes
The tests rely on the subclass My_Middleware (in the test file) calling $this->next->call(), so the base class must expose a protected $next property and provide the setter/getter.
The tests also call setApplication/getApplication on My_Middleware, so the base class must implement setApplication and getApplication to store and return the application instance.