From 43a5f72a643a95af5990032d6d58922b8f56a733 Mon Sep 17 00:00:00 2001 From: Bruno Spyckerelle Date: Sat, 22 Feb 2020 14:49:58 +0100 Subject: [PATCH] Add option to print request and response --- src/NMB2BClient.php | 8 ++++++++ src/Services/AirspaceServices.php | 10 +++++++++- src/Services/FlowServices.php | 4 ++++ src/Services/Service.php | 14 +++++++++++++- 4 files changed, 34 insertions(+), 2 deletions(-) diff --git a/src/NMB2BClient.php b/src/NMB2BClient.php index 376a960..e334766 100644 --- a/src/NMB2BClient.php +++ b/src/NMB2BClient.php @@ -28,6 +28,8 @@ class NMB2BClient { + private $verbose = false; + private $airspaceServices; private $flowServices; @@ -112,4 +114,10 @@ public function flowServices() : FlowServices } return $this->flowServices; } + + public function setVerbose($verbose) + { + $this->verbose = $verbose; + } + } \ No newline at end of file diff --git a/src/Services/AirspaceServices.php b/src/Services/AirspaceServices.php index dabff32..3adb0c7 100644 --- a/src/Services/AirspaceServices.php +++ b/src/Services/AirspaceServices.php @@ -41,7 +41,11 @@ public function retrieveEAUPChain(\DateTime $chainDate): EAUPChain ); $this->getSoapClient()->retrieveEAUPChain($params); - + + if($this->isVerbose()) { + print_r($this->getFullErrorMessage()); + } + return new EAUPChain($this->getSoapClient()->__getLastResponse()); } @@ -69,6 +73,10 @@ public function retrieveEAUPRSAs($designators, \DateTime $date, $sequenceNumber) $this->getSoapClient()->retrieveEAUPRSAs($params); + if($this->isVerbose()) { + print_r($this->getFullErrorMessage()); + } + return new EAUPRSAs($this->getSoapClient()->__getLastResponse(), $this->getNMVersionFloat()); } } \ No newline at end of file diff --git a/src/Services/FlowServices.php b/src/Services/FlowServices.php index 635cab4..5bae79e 100644 --- a/src/Services/FlowServices.php +++ b/src/Services/FlowServices.php @@ -56,6 +56,10 @@ public function queryRegulations(\DateTime $start, \DateTime $end, $regex = "LF* $this->getSoapClient()->queryRegulations($params); + if($this->isVerbose()) { + print_r($this->getFullErrorMessage()); + } + return new RegulationListReply($this->getSoapClient()->__getLastResponse()); } } \ No newline at end of file diff --git a/src/Services/Service.php b/src/Services/Service.php index 4b91389..859c0e9 100644 --- a/src/Services/Service.php +++ b/src/Services/Service.php @@ -26,8 +26,9 @@ class Service { private $versionFloat; + private $verbose = false; - public function __construct($wsdl, $options) + public function __construct($wsdl, $options, $verbose) { $this->client = new \SoapClient($wsdl, $options); $this->extractNMVersion($wsdl); @@ -81,4 +82,15 @@ public function getNMVersion() : string public function getNMVersionFloat() : float { return $this->versionFloat; } + + public function setVerbose($verbose) + { + $this->verbose = $verbose; + } + + public function isVerbose() + { + return $this->verbose; + } + } \ No newline at end of file