File tree Expand file tree Collapse file tree 1 file changed +14
-13
lines changed
src/Artisaninweb/SoapWrapper Expand file tree Collapse file tree 1 file changed +14
-13
lines changed Original file line number Diff line number Diff line change @@ -100,23 +100,24 @@ public function addByArray(array $services = [])
100100 * @return mixed
101101 * @throws ServiceNotFound
102102 */
103- public function client ($ name , Closure $ closure = null )
104- {
105- if ($ this ->has ($ name )) {
106- /** @var Service $service */
107- $ service = $ this ->services [$ name ];
108- $ client = $ service ->getClient ();
103+ public function client ($ name , Closure $ closure = null )
104+ {
105+ if ($ this ->has ($ name )) {
106+ /** @var Service $service */
107+ $ service = $ this ->services [$ name ];
108+
109+ if (is_null ($ service ->getClient ())) {
110+ $ client = new Client ($ service ->getWsdl (), $ service ->getOptions ());
111+ } else {
112+ $ client = $ service ->getClient ();
113+ }
109114
110- if (!$ client instanceof SoapClient) {
111- $ client = new Client ($ service ->getWsdl (), $ service ->getOptions ());
112- }
115+ return $ closure ($ client );
116+ }
113117
114- return $ closure ( $ client );
118+ throw new ServiceNotFound ( " Service ' " . $ name . " ' not found. " );
115119 }
116120
117- throw new ServiceNotFound ("Service ' " . $ name . "' not found. " );
118- }
119-
120121 /**
121122 * A easy access call method
122123 *
You can’t perform that action at this time.
0 commit comments