Skip to content

Commit 859f4c5

Browse files
Jean85dbu
authored andcommitted
[2.0] Remove plugin chain debug (#119)
Complete removal of debug_plugins
1 parent 1adbf74 commit 859f4c5

File tree

2 files changed

+1
-54
lines changed

2 files changed

+1
-54
lines changed

spec/PluginClientSpec.php

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -87,47 +87,4 @@ function it_throws_loop_exception(HttpClient $httpClient, RequestInterface $requ
8787

8888
$this->shouldThrow('Http\Client\Common\Exception\LoopException')->duringSendRequest($request);
8989
}
90-
91-
function it_injects_debug_plugins(HttpClient $httpClient, ResponseInterface $response, RequestInterface $request, Plugin $plugin0, Plugin $plugin1, Plugin $debugPlugin)
92-
{
93-
$plugin0
94-
->handleRequest(
95-
$request,
96-
Argument::type('callable'),
97-
Argument::type('callable')
98-
)
99-
->shouldBeCalledTimes(1)
100-
->will(function ($args) {
101-
return $args[1]($args[0]);
102-
})
103-
;
104-
$plugin1
105-
->handleRequest(
106-
$request,
107-
Argument::type('callable'),
108-
Argument::type('callable')
109-
)
110-
->shouldBeCalledTimes(1)
111-
->will(function ($args) {
112-
return $args[1]($args[0]);
113-
})
114-
;
115-
116-
$debugPlugin
117-
->handleRequest(
118-
$request,
119-
Argument::type('callable'),
120-
Argument::type('callable')
121-
)
122-
->shouldBeCalledTimes(3)
123-
->will(function ($args) {
124-
return $args[1]($args[0]);
125-
})
126-
;
127-
128-
$httpClient->sendRequest($request)->willReturn($response);
129-
130-
$this->beConstructedWith($httpClient, [$plugin0, $plugin1], ['debug_plugins'=>[$debugPlugin]]);
131-
$this->sendRequest($request);
132-
}
13390
}

src/PluginClient.php

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ final class PluginClient implements HttpClient, HttpAsyncClient
4646
* @param array $options {
4747
*
4848
* @var int $max_restarts
49-
* @var Plugin[] $debug_plugins an array of plugins that are injected between each normal plugin
5049
* }
5150
*
5251
* @throws \RuntimeException if client is not an instance of HttpClient or HttpAsyncClient
@@ -131,16 +130,7 @@ private function createPluginChain($pluginList, callable $clientCallable)
131130
{
132131
$firstCallable = $lastCallable = $clientCallable;
133132

134-
/*
135-
* Inject debug plugins between each plugin.
136-
*/
137-
$pluginListWithDebug = $this->options['debug_plugins'];
138-
foreach ($pluginList as $plugin) {
139-
$pluginListWithDebug[] = $plugin;
140-
$pluginListWithDebug = array_merge($pluginListWithDebug, $this->options['debug_plugins']);
141-
}
142-
143-
while ($plugin = array_pop($pluginListWithDebug)) {
133+
while ($plugin = array_pop($pluginList)) {
144134
$lastCallable = function (RequestInterface $request) use ($plugin, $lastCallable, &$firstCallable) {
145135
return $plugin->handleRequest($request, $lastCallable, $firstCallable);
146136
};

0 commit comments

Comments
 (0)