Skip to content

Commit

Permalink
Use symfony 4 event dispatcher
Browse files Browse the repository at this point in the history
  • Loading branch information
bensonarts committed Dec 9, 2020
1 parent dbd76b8 commit 39612c8
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
vendor
composer.lock
composer.lock
.idea
13 changes: 7 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@
"ext-soap": "*",
"ext-xml": "*",
"doctrine/collections": "~1.3",
"psr/event-dispatcher": "^1.0",
"psr/log": "^1.0",
"symfony/console": "~2.8|~3.0|~4.0",
"symfony/event-dispatcher": "~2.8|~3.0|~4.0",
"symfony/filesystem": "~2.8|~3.0|~4.0",
"symfony/validator": "~2.8|~3.0|~4.0"
"symfony/console": "~4.0",
"symfony/event-dispatcher": "~4.0",
"symfony/filesystem": "~4.0",
"symfony/validator": "~4.0"
},
"require-dev": {
"guzzlehttp/guzzle": "^6.3.2",
Expand All @@ -34,10 +35,10 @@
"php-http/message": "^1.6",
"php-http/message-factory": "^1.0",
"php-http/mock-client": "^1.0",
"php-vcr/php-vcr": "~1.3.2",
"php-vcr/php-vcr": "1.4.5",
"php-vcr/phpunit-testlistener-vcr": "3.0",
"phpro/grumphp": "~0.11",
"phpspec/phpspec": "~3.2",
"phpspec/phpspec": "~7.0",
"phpspec/prophecy": "~1.7",
"phpunit/phpunit": "~6.0",
"psr/http-message": "^1.0",
Expand Down
6 changes: 3 additions & 3 deletions src/Phpro/SoapClient/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public function changeSoapLocation(string $location)
protected function call(string $method, RequestInterface $request): ResultInterface
{
$requestEvent = new Event\RequestEvent($this, $method, $request);
$this->dispatcher->dispatch(Events::REQUEST, $requestEvent);
$this->dispatcher->dispatch($requestEvent, Events::REQUEST);

try {
$arguments = ($request instanceof MultiArgumentRequestInterface) ? $request->getArguments() : [$request];
Expand All @@ -103,11 +103,11 @@ protected function call(string $method, RequestInterface $request): ResultInterf
}
} catch (\Exception $exception) {
$soapException = SoapException::fromThrowable($exception);
$this->dispatcher->dispatch(Events::FAULT, new Event\FaultEvent($this, $soapException, $requestEvent));
$this->dispatcher->dispatch(new Event\FaultEvent($this, $soapException, $requestEvent), Events::FAULT);
throw $soapException;
}

$this->dispatcher->dispatch(Events::RESPONSE, new Event\ResponseEvent($this, $requestEvent, $result));
$this->dispatcher->dispatch(new Event\ResponseEvent($this, $requestEvent, $result), Events::RESPONSE);
return $result;
}
}

0 comments on commit 39612c8

Please sign in to comment.