Completed
Pull Request — master (#128)
by Fabien
09:03
created

Stack   A

Complexity

Total Complexity 9

Size/Duplication

Total Lines 101
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 91.3%

Importance

Changes 0
Metric Value
wmc 9
lcom 1
cbo 0
dl 0
loc 101
ccs 21
cts 23
cp 0.913
rs 10
c 0
b 0
f 0

9 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getClient() 0 4 1
A addProfile() 0 4 1
A getProfiles() 0 4 1
A getRequest() 0 4 1
A getResponse() 0 4 1
A setResponse() 0 4 1
A isFailed() 0 4 1
A setFailed() 0 4 1
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
     * @param string $client
41
     * @param string $request
42
     */
43 7
    public function __construct($client, $request)
44
    {
45 7
        $this->client = $client;
46 7
        $this->request = $request;
47 7
    }
48
49
    /**
50
     * @return string
51
     */
52 1
    public function getClient()
53
    {
54 1
        return $this->client;
55
    }
56
57
    /**
58
     * @param Profile $profile
59
     */
60 4
    public function addProfile(Profile $profile)
61
    {
62 4
        $this->profiles[] = $profile;
63 4
    }
64
65
    /**
66
     * @return Profile[]
67
     */
68 2
    public function getProfiles()
69
    {
70 2
        return $this->profiles;
71
    }
72
73
    /**
74
     * @return string
75
     */
76 1
    public function getRequest()
77
    {
78 1
        return $this->request;
79
    }
80
81
    /**
82
     * @return string
83
     */
84 1
    public function getResponse()
85
    {
86 1
        return $this->response;
87
    }
88
89
    /**
90
     * @param string $response
91
     */
92 2
    public function setResponse($response)
93
    {
94 2
        $this->response = $response;
95 2
    }
96
97
    /**
98
     * @return bool
99
     */
100
    public function isFailed()
101
    {
102
        return $this->failed;
103
    }
104
105
    /**
106
     * @param bool $failed
107
     */
108 1
    public function setFailed($failed)
109
    {
110 1
        $this->failed = $failed;
111 1
    }
112
}
113