Skip to content

Commit 2080091

Browse files
committed
Allow to definte the factories in the constructor
1 parent 004419f commit 2080091

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1111

1212
- Use `phpstan` as a dev dependency to detect bugs
1313

14+
### Added
15+
16+
- Added `responseFactory` option to `__construct`
17+
1418
## [1.1.0] - 2018-08-04
1519

1620
### Added

src/TrailingSlash.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
namespace Middlewares;
55

66
use Middlewares\Utils\Traits\HasResponseFactory;
7+
use Middlewares\Utils\Factory;
8+
use Psr\Http\Message\ResponseFactoryInterface;
79
use Psr\Http\Message\ResponseInterface;
810
use Psr\Http\Message\ServerRequestInterface;
911
use Psr\Http\Server\MiddlewareInterface;
@@ -26,9 +28,10 @@ class TrailingSlash implements MiddlewareInterface
2628
/**
2729
* Configure whether add or remove the slash.
2830
*/
29-
public function __construct(bool $trailingSlash = false)
31+
public function __construct(bool $trailingSlash = false, ResponseFactoryInterface $responseFactory = null)
3032
{
3133
$this->trailingSlash = $trailingSlash;
34+
$this->responseFactory = $responseFactory ?: Factory::getResponseFactory();
3235
}
3336

3437
/**

0 commit comments

Comments
 (0)