Skip to content

Commit 97f7943

Browse files
committed
Style fixes and comments
1 parent 0033d14 commit 97f7943

File tree

8 files changed

+35
-21
lines changed

8 files changed

+35
-21
lines changed

Collector/DebugPlugin.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
*
1313
* @author Tobias Nyholm <[email protected]>
1414
*/
15-
class DebugPlugin implements Plugin
15+
final class DebugPlugin implements Plugin
1616
{
1717
/**
1818
* @var DebugPluginCollector

Collector/DebugPluginCollector.php

+16-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*
1616
* @author Tobias Nyholm <[email protected]>
1717
*/
18-
class DebugPluginCollector extends DataCollector
18+
final class DebugPluginCollector extends DataCollector
1919
{
2020
/**
2121
* @var Formatter
@@ -29,6 +29,7 @@ class DebugPluginCollector extends DataCollector
2929

3030
/**
3131
* @param Formatter $formatter
32+
* @param PluginJournal $journal
3233
*/
3334
public function __construct(Formatter $formatter, PluginJournal $journal)
3435
{
@@ -38,6 +39,8 @@ public function __construct(Formatter $formatter, PluginJournal $journal)
3839

3940
/**
4041
* @param RequestInterface $request
42+
* @param string $clientName
43+
* @param int $depth
4144
*/
4245
public function addRequest(RequestInterface $request, $clientName, $depth)
4346
{
@@ -46,6 +49,8 @@ public function addRequest(RequestInterface $request, $clientName, $depth)
4649

4750
/**
4851
* @param ResponseInterface $response
52+
* @param string $clientName
53+
* @param int $depth
4954
*/
5055
public function addResponse(ResponseInterface $response, $clientName, $depth)
5156
{
@@ -55,6 +60,8 @@ public function addResponse(ResponseInterface $response, $clientName, $depth)
5560

5661
/**
5762
* @param Exception $exception
63+
* @param string $clientName
64+
* @param int $depth
5865
*/
5966
public function addFailure(Exception $exception, $clientName, $depth)
6067
{
@@ -79,6 +86,7 @@ public function getSucessfulRequests()
7986
{
8087
$count = 0;
8188
foreach ($this->data as $client) {
89+
8290
if (isset($client['failure'])) {
8391
foreach ($client['failure'][0] as $failure) {
8492
if (!$failure) {
@@ -100,6 +108,7 @@ public function getFailedRequests()
100108
{
101109
$count = 0;
102110
foreach ($this->data as $client) {
111+
103112
if (isset($client['failure'])) {
104113
foreach ($client['failure'][0] as $failure) {
105114
if ($failure) {
@@ -156,11 +165,17 @@ public function getName()
156165
return 'httplug';
157166
}
158167

168+
/**
169+
* {@inheritdoc}
170+
*/
159171
public function serialize()
160172
{
161173
return serialize([$this->data, $this->journal]);
162174
}
163175

176+
/**
177+
* {@inheritdoc}
178+
*/
164179
public function unserialize($data)
165180
{
166181
list($this->data, $this->journal) = unserialize($data);

Collector/PluginJournal.php

+6-5
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,16 @@
77
*
88
* @author Tobias Nyholm <[email protected]>
99
*/
10-
class PluginJournal
10+
final class PluginJournal
1111
{
1212
/**
1313
* @var array ['clientName'=>['index' => 'PluginName']
1414
*/
1515
private $data;
1616

1717
/**
18+
* @param string $clientName
19+
*
1820
* @return array
1921
*/
2022
public function getPlugins($clientName)
@@ -23,6 +25,9 @@ public function getPlugins($clientName)
2325
}
2426

2527
/**
28+
* @param string $clientName
29+
* @param int $idx
30+
*
2631
* @return string|null
2732
*/
2833
public function getPluginName($clientName, $idx)
@@ -37,13 +42,9 @@ public function getPluginName($clientName, $idx)
3742
/**
3843
* @param string $clientName
3944
* @param array $plugins
40-
*
41-
* @return $this
4245
*/
4346
public function setPlugins($clientName, array $plugins)
4447
{
4548
$this->data[$clientName] = $plugins;
46-
47-
return $this;
4849
}
4950
}

Collector/RequestStackProvider.php

+9-9
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@
1010
*
1111
* @author Tobias Nyholm <[email protected]>
1212
*/
13-
class RequestStackProvider
13+
final class RequestStackProvider
1414
{
1515
/**
1616
* Array that tell if a request errored or not. true = success, false = failure.
1717
*
1818
* @var array
1919
*/
20-
private $failure;
20+
private $failures;
2121

2222
/**
2323
* A multidimensional array with requests.
@@ -38,13 +38,13 @@ class RequestStackProvider
3838
private $responses;
3939

4040
/**
41-
* @param array $failure if the response was successful or not
41+
* @param array $failures if the response was successful or not
4242
* @param array $requests
4343
* @param array $responses
4444
*/
45-
public function __construct(array $failure, array $requests, array $responses)
45+
public function __construct(array $failures, array $requests, array $responses)
4646
{
47-
$this->failure = $failure;
47+
$this->failures = $failures;
4848
$this->requests = $requests;
4949
$this->responses = $responses;
5050
}
@@ -112,7 +112,7 @@ public function getStackIndexKeys()
112112
/**
113113
* @param int $idx
114114
*
115-
* @return array responses
115+
* @return array
116116
*/
117117
public function getRequstStack($idx)
118118
{
@@ -122,7 +122,7 @@ public function getRequstStack($idx)
122122
/**
123123
* @param int $idx
124124
*
125-
* @return array responses
125+
* @return array
126126
*/
127127
public function getResponseStack($idx)
128128
{
@@ -132,10 +132,10 @@ public function getResponseStack($idx)
132132
/**
133133
* @param int $idx
134134
*
135-
* @return array failures
135+
* @return array
136136
*/
137137
public function getFailureStack($idx)
138138
{
139-
return $this->failure[$idx];
139+
return $this->failures[$idx];
140140
}
141141
}

Resources/public/script/httplug.js

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
2-
31
/**
42
* Toggle hide/show on the message body
53
*/

Resources/public/style/httplug.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@
2121
}
2222
.httplug-error {
2323
color: red;
24-
}
24+
}

Resources/views/webprofiler.html.twig

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
{% for stackIndex in client.stackIndexKeys %}
6767
{% set failureStack = client.failureStack(stackIndex) %}
6868
<h3>
69-
Request {{ stackIndex }}
69+
Request #{{ stackIndex }}
7070
{% if failureStack[0] %}
7171
- <span class="httplug-error">Errored</span>
7272
{% endif %}

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"symfony/framework-bundle": "^2.7 || ^3.0",
2929
"php-http/message": "^1.3",
3030
"php-http/discovery": "^0.9",
31-
"twig/twig": "^1.18|^2.0"
31+
"twig/twig": "^1.18||^2.0"
3232
},
3333
"require-dev": {
3434
"phpunit/phpunit": "^4.5",

0 commit comments

Comments
 (0)