Issues (43)

src/Decorator/ResponseDecorator.php (3 issues)

Labels
Severity
1
<?php
2
3
namespace Http\Message\Decorator;
4
5
use Psr\Http\Message\ResponseInterface;
6
7
/**
8
 * @author Márk Sági-Kazár <[email protected]>
9
 */
10
trait ResponseDecorator
11
{
12
    use MessageDecorator {
13
        getMessage as getResponse;
14
    }
15
16
    /**
17
     * Exchanges the underlying response with another.
18
     *
19
     * @return self
20
     */
21
    public function withResponse(ResponseInterface $response)
22
    {
23 1
        $new = clone $this;
24
        $new->message = $response;
25 1
26 1
        return $new;
27
    }
28 1
29
    /**
30
     * {@inheritdoc}
31
     */
32
    public function getStatusCode()
33
    {
34 1
        return $this->message->getStatusCode();
0 ignored issues
show
The method getStatusCode() does not exist on Psr\Http\Message\MessageInterface. It seems like you code against a sub-type of Psr\Http\Message\MessageInterface such as Psr\Http\Message\ResponseInterface or Slim\Http\Response. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

34
        return $this->message->/** @scrutinizer ignore-call */ getStatusCode();
Loading history...
35
    }
36 1
37
    /**
38
     * {@inheritdoc}
39
     */
40
    public function withStatus($code, $reasonPhrase = '')
41
    {
42 1
        $new = clone $this;
43
        $new->message = $this->message->withStatus($code, $reasonPhrase);
0 ignored issues
show
The method withStatus() does not exist on Psr\Http\Message\MessageInterface. It seems like you code against a sub-type of Psr\Http\Message\MessageInterface such as Psr\Http\Message\ResponseInterface or Slim\Http\Response. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

43
        /** @scrutinizer ignore-call */ 
44
        $new->message = $this->message->withStatus($code, $reasonPhrase);
Loading history...
44 1
45 1
        return $new;
46
    }
47 1
48
    /**
49
     * {@inheritdoc}
50
     */
51
    public function getReasonPhrase()
52
    {
53 1
        return $this->message->getReasonPhrase();
0 ignored issues
show
The method getReasonPhrase() does not exist on Psr\Http\Message\MessageInterface. It seems like you code against a sub-type of Psr\Http\Message\MessageInterface such as Psr\Http\Message\ResponseInterface or Slim\Http\Response. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

53
        return $this->message->/** @scrutinizer ignore-call */ getReasonPhrase();
Loading history...
54
    }
55
}
56