Skip to content

Commit f9c7c78

Browse files
author
Xavier HAUSHERR
committed
Debug Ws Client
1 parent 9827f6f commit f9c7c78

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

Client/WsClient.php

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,26 +69,38 @@ public function __construct(Array $urls, WsLoggerInterface $logger = null)
6969

7070
foreach($urls as $name => $config)
7171
{
72-
$this->createConnection($name, $config['url'], $config['type'], $config['timeout']);
72+
$this->setConnection($name, $config['url'], $config['type'], (isset($config['timeout']) ? $config['timeout'] : null));
7373
}
7474
}
7575

76-
/**
77-
* Create a connection manually
76+
/**
77+
* Set connection
7878
* @param string $name
7979
* @param string $url
8080
* @param string $type
8181
* @param int $timeout
8282
* @return WsClient
8383
*/
84-
public function createConnection($name, $url, $type = 'rest', $timeout = 1000)
85-
{
86-
$this->urls[$name] = array(
84+
protected function setConnection($name, $url, $type = 'rest', $timeout = 1000)
85+
{
86+
$this->urls[$name] = array(
8787
'url' => $url,
8888
'type' => $type,
8989
'timeout' => $timeout
9090
);
91+
}
9192

93+
/**
94+
* Create a connection manually
95+
* @param string $name
96+
* @param string $url
97+
* @param string $type
98+
* @param int $timeout
99+
* @return WsClient
100+
*/
101+
public function createConnection($name, $url, $type = 'rest', $timeout = 1000)
102+
{
103+
$this->setConnection($name, $url, $type, $timeout);
92104
return $this->getConnection($name);
93105
}
94106

0 commit comments

Comments
 (0)