Completed
Pull Request — master (#136)
by Fabien
04:41
created

Stack::getRequestMethod()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php
2
3
namespace Http\HttplugBundle\Collector;
4
5
/**
6
 * A Stack hold a collection of Profile to track the whole request execution.
7
 *
8
 * @author Fabien Bourigault <[email protected]>
9
 *
10
 * @internal
11
 */
12
final class Stack
13
{
14
    /**
15
     * @var string
16
     */
17
    private $client;
18
19
    /**
20
     * @var Profile[]
21
     */
22
    private $profiles = [];
23
24
    /**
25
     * @var string
26
     */
27
    private $request;
28
29
    /**
30
     * @var string
31
     */
32
    private $response;
33
34
    /**
35
     * @var bool
36
     */
37
    private $failed = false;
38
39
    /**
40
     * @var string
41
     */
42
    private $requestTarget;
43
44
    /**
45
     * @var string
46
     */
47
    private $requestMethod;
48
49
    /**
50
     * @param string $client
51
     * @param string $request
52
     */
53 7
    public function __construct($client, $request)
54
    {
55 7
        $this->client = $client;
56 7
        $this->request = $request;
57 7
    }
58
59
    /**
60
     * @return string
61
     */
62 1
    public function getClient()
63
    {
64 1
        return $this->client;
65
    }
66
67
    /**
68
     * @param Profile $profile
69
     */
70 4
    public function addProfile(Profile $profile)
71
    {
72 4
        $this->profiles[] = $profile;
73 4
    }
74
75
    /**
76
     * @return Profile[]
77
     */
78 2
    public function getProfiles()
79
    {
80 2
        return $this->profiles;
81
    }
82
83
    /**
84
     * @return string
85
     */
86 1
    public function getRequest()
87
    {
88 1
        return $this->request;
89
    }
90
91
    /**
92
     * @return string
93
     */
94 1
    public function getResponse()
95
    {
96 1
        return $this->response;
97
    }
98
99
    /**
100
     * @param string $response
101
     */
102 2
    public function setResponse($response)
103
    {
104 2
        $this->response = $response;
105 2
    }
106
107
    /**
108
     * @return bool
109
     */
110
    public function isFailed()
111
    {
112
        return $this->failed;
113
    }
114
115
    /**
116
     * @param bool $failed
117
     */
118 1
    public function setFailed($failed)
119
    {
120 1
        $this->failed = $failed;
121 1
    }
122
123
    /**
124
     * @return string
125
     */
126
    public function getRequestTarget()
127
    {
128
        return $this->requestTarget;
129
    }
130
131
    /**
132
     * @param string $requestTarget
133
     */
134
    public function setRequestTarget($requestTarget)
135
    {
136
        $this->requestTarget = $requestTarget;
137
    }
138
139
    /**
140
     * @return string
141
     */
142
    public function getRequestMethod()
143
    {
144
        return $this->requestMethod;
145
    }
146
147
    /**
148
     * @param string $requestMethod
149
     */
150
    public function setRequestMethod($requestMethod)
151
    {
152
        $this->requestMethod = $requestMethod;
153
    }
154
}
155