Skip to content

Commit 9558ed7

Browse files
committed
Add validation for PluginClient::setPlugins method
1 parent 16c25b5 commit 9558ed7

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/PluginClient.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public function __construct($client, array $plugins = [], array $options = [])
5757
throw new \RuntimeException('Client must be an instance of Http\\Client\\HttpClient or Http\\Client\\HttpAsyncClient');
5858
}
5959

60-
$this->plugins = $plugins;
60+
$this->plugins = $this->setPlugins($plugins);
6161
$this->options = $this->configure($options);
6262
}
6363

@@ -88,7 +88,9 @@ public function getPlugins()
8888
*/
8989
public function setPlugins(array $plugins = [])
9090
{
91-
$this->plugins = $plugins;
91+
foreach ($plugins as $plugin) {
92+
$this->addPlugin($plugin);
93+
}
9294
}
9395

9496
/**

0 commit comments

Comments
 (0)