From aa1dfdf0f8aaccf7dfd32fb0de4b4fbd123dceac Mon Sep 17 00:00:00 2001 From: Christian Kerl Date: Thu, 7 Apr 2011 21:49:59 +0200 Subject: [PATCH] refactored service definition dumper classes --- ServiceDefinition/Dumper/DumperInterface.php | 2 +- ServiceDefinition/Dumper/FileDumper.php | 30 ------------------- .../{WsdlFileDumper.php => WsdlDumper.php} | 12 ++++---- 3 files changed, 6 insertions(+), 38 deletions(-) delete mode 100644 ServiceDefinition/Dumper/FileDumper.php rename ServiceDefinition/Dumper/{WsdlFileDumper.php => WsdlDumper.php} (96%) diff --git a/ServiceDefinition/Dumper/DumperInterface.php b/ServiceDefinition/Dumper/DumperInterface.php index 4ae8701..f957435 100644 --- a/ServiceDefinition/Dumper/DumperInterface.php +++ b/ServiceDefinition/Dumper/DumperInterface.php @@ -14,5 +14,5 @@ use Bundle\WebServiceBundle\ServiceDefinition\ServiceDefinition; interface DumperInterface { - function dumpServiceDefinition(ServiceDefinition $definition); + function dumpServiceDefinition(ServiceDefinition $definition, array $options = array()); } \ No newline at end of file diff --git a/ServiceDefinition/Dumper/FileDumper.php b/ServiceDefinition/Dumper/FileDumper.php deleted file mode 100644 index 577e8c6..0000000 --- a/ServiceDefinition/Dumper/FileDumper.php +++ /dev/null @@ -1,30 +0,0 @@ - - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - -namespace Bundle\WebServiceBundle\ServiceDefinition\Dumper; - -use Bundle\WebServiceBundle\ServiceDefinition\Dumper\DumperInterface; -use Bundle\WebServiceBundle\Util\Assert; - -/** - * - * @author Christian Kerl - */ -abstract class FileDumper implements DumperInterface -{ - protected $file; - - public function __construct($file) - { - Assert::thatArgumentNotNull('file', $file); - - $this->file = $file; - } -} diff --git a/ServiceDefinition/Dumper/WsdlFileDumper.php b/ServiceDefinition/Dumper/WsdlDumper.php similarity index 96% rename from ServiceDefinition/Dumper/WsdlFileDumper.php rename to ServiceDefinition/Dumper/WsdlDumper.php index 45746bf..3bccef6 100644 --- a/ServiceDefinition/Dumper/WsdlFileDumper.php +++ b/ServiceDefinition/Dumper/WsdlDumper.php @@ -22,11 +22,11 @@ use Zend\Soap\Wsdl; * * @author Christian Kerl */ -class WsdlFileDumper extends FileDumper +class WsdlDumper implements DumperInterface { private $definition; - - public function dumpServiceDefinition(ServiceDefinition $definition) + + public function dumpServiceDefinition(ServiceDefinition $definition, array $options = array()) { Assert::thatArgumentNotNull('definition', $definition); @@ -75,13 +75,11 @@ class WsdlFileDumper extends FileDumper $wsdl->addSoapOperation($bindingOperation, $this->getSoapOperationName($method)); } - $wsdl->dump($this->file); - $this->definition = null; - return $this->file; + return $wsdl->toXml(); } - + protected function getPortTypeName() { return $this->definition->getName() . 'PortType';