Passed
Pull Request — master (#73)
by Dmitriy
14:14
created

DeferredResponseFactory::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
nc 1
nop 2
1
<?php
2
3
namespace App;
4
5
use Psr\Http\Message\ResponseFactoryInterface;
6
use Psr\Http\Message\ResponseInterface;
7
use Psr\Http\Message\StreamFactoryInterface;
8
9
class DeferredResponseFactory implements ResponseFactoryInterface
10
{
11
    private ResponseFactoryInterface $responseFactory;
12
13
    private StreamFactoryInterface $streamFactory;
14
15
    public function __construct(ResponseFactoryInterface $responseFactory, StreamFactoryInterface $streamFactory)
16
    {
17
        $this->responseFactory = $responseFactory;
18
        $this->streamFactory = $streamFactory;
19
    }
20
21
    public function createResponse(int $code = 200, string $reasonPhrase = '', $data = null): ResponseInterface
22
    {
23
        return new DeferredResponse($data, $this->responseFactory, $this->streamFactory);
24
    }
25
}
26