RequestDecorator   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 74
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 18
dl 0
loc 74
ccs 21
cts 21
cp 1
rs 10
c 1
b 0
f 0
wmc 7

7 Methods

Rating   Name   Duplication   Size   Complexity  
A getMethod() 0 3 1
A withRequestTarget() 0 6 1
A withRequest() 0 6 1
A withUri() 0 6 1
A getRequestTarget() 0 3 1
A getUri() 0 3 1
A withMethod() 0 6 1
1
<?php
2
3
namespace Http\Message\Decorator;
4
5
use Psr\Http\Message\RequestInterface;
6
use Psr\Http\Message\UriInterface;
7
8
/**
9
 * @author Márk Sági-Kazár <[email protected]>
10
 */
11
trait RequestDecorator
12
{
13
    use MessageDecorator {
14
        getMessage as getRequest;
15
    }
16
17
    /**
18
     * Exchanges the underlying request with another.
19
     *
20
     * @return self
21
     */
22
    public function withRequest(RequestInterface $request)
23
    {
24 1
        $new = clone $this;
25
        $new->message = $request;
26 1
27 1
        return $new;
28
    }
29 1
30
    /**
31
     * {@inheritdoc}
32
     */
33
    public function getRequestTarget()
34
    {
35 1
        return $this->message->getRequestTarget();
0 ignored issues
show
Bug introduced by
The method getRequestTarget() 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\RequestInterface or Slim\Http\Request. ( Ignorable by Annotation )

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

35
        return $this->message->/** @scrutinizer ignore-call */ getRequestTarget();
Loading history...
36
    }
37 1
38
    /**
39
     * {@inheritdoc}
40
     */
41
    public function withRequestTarget($requestTarget)
42
    {
43 1
        $new = clone $this;
44
        $new->message = $this->message->withRequestTarget($requestTarget);
0 ignored issues
show
Bug introduced by
The method withRequestTarget() 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\RequestInterface or Slim\Http\Request. ( Ignorable by Annotation )

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

44
        /** @scrutinizer ignore-call */ 
45
        $new->message = $this->message->withRequestTarget($requestTarget);
Loading history...
45 1
46 1
        return $new;
47
    }
48 1
49
    /**
50
     * {@inheritdoc}
51
     */
52
    public function getMethod()
53
    {
54 1
        return $this->message->getMethod();
0 ignored issues
show
Bug introduced by
The method getMethod() 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\RequestInterface or Slim\Http\Request. ( Ignorable by Annotation )

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

54
        return $this->message->/** @scrutinizer ignore-call */ getMethod();
Loading history...
55
    }
56 1
57
    /**
58
     * {@inheritdoc}
59
     */
60
    public function withMethod($method)
61
    {
62 1
        $new = clone $this;
63
        $new->message = $this->message->withMethod($method);
0 ignored issues
show
Bug introduced by
The method withMethod() 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\RequestInterface or Slim\Http\Request. ( Ignorable by Annotation )

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

63
        /** @scrutinizer ignore-call */ 
64
        $new->message = $this->message->withMethod($method);
Loading history...
64 1
65 1
        return $new;
66
    }
67 1
68
    /**
69
     * {@inheritdoc}
70
     */
71
    public function getUri()
72
    {
73 1
        return $this->message->getUri();
0 ignored issues
show
Bug introduced by
The method getUri() 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\RequestInterface or Slim\Http\Request. ( Ignorable by Annotation )

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

73
        return $this->message->/** @scrutinizer ignore-call */ getUri();
Loading history...
74
    }
75 1
76
    /**
77
     * {@inheritdoc}
78
     */
79
    public function withUri(UriInterface $uri, $preserveHost = false)
80
    {
81 1
        $new = clone $this;
82
        $new->message = $this->message->withUri($uri, $preserveHost);
0 ignored issues
show
Bug introduced by
The method withUri() 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\RequestInterface or Slim\Http\Request. ( Ignorable by Annotation )

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

82
        /** @scrutinizer ignore-call */ 
83
        $new->message = $this->message->withUri($uri, $preserveHost);
Loading history...
83 1
84 1
        return $new;
85
    }
86
}
87