Completed
Push — master ( 82b31e...62eba7 )
by Márk
06:10 queued 02:58
created

RequestDecorator::getMethod()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 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
     * @param RequestInterface $request
21
     *
22
     * @return self
23
     */
24 1
    public function withRequest(RequestInterface $request)
25
    {
26 1
        $new = clone $this;
27 1
        $new->message = $request;
28
29 1
        return $new;
30
    }
31
32
    /**
33
     * {@inheritdoc}
34
     */
35 1
    public function getRequestTarget()
36
    {
37 1
        return $this->message->getRequestTarget();
38
    }
39
40
    /**
41
     * {@inheritdoc}
42
     */
43 1
    public function withRequestTarget($requestTarget)
44
    {
45 1
        $new = clone $this;
46 1
        $new->message = $this->message->withRequestTarget($requestTarget);
47
48 1
        return $new;
49
    }
50
51
    /**
52
     * {@inheritdoc}
53
     */
54 1
    public function getMethod()
55
    {
56 1
        return $this->message->getMethod();
57
    }
58
59
    /**
60
     * {@inheritdoc}
61
     */
62 1
    public function withMethod($method)
63
    {
64 1
        $new = clone $this;
65 1
        $new->message = $this->message->withMethod($method);
66
67 1
        return $new;
68
    }
69
70
    /**
71
     * {@inheritdoc}
72
     */
73 1
    public function getUri()
74
    {
75 1
        return $this->message->getUri();
76
    }
77
78
    /**
79
     * {@inheritdoc}
80
     */
81 1
    public function withUri(UriInterface $uri, $preserveHost = false)
82
    {
83 1
        $new = clone $this;
84 1
        $new->message = $this->message->withUri($uri, $preserveHost);
85
86 1
        return $new;
87
    }
88
}
89