refactored service definition dumper classes

This commit is contained in:
Christian Kerl 2011-04-07 21:49:59 +02:00
parent ff6eca48ee
commit aa1dfdf0f8
3 changed files with 6 additions and 38 deletions

View File

@ -14,5 +14,5 @@ use Bundle\WebServiceBundle\ServiceDefinition\ServiceDefinition;
interface DumperInterface
{
function dumpServiceDefinition(ServiceDefinition $definition);
function dumpServiceDefinition(ServiceDefinition $definition, array $options = array());
}

View File

@ -1,30 +0,0 @@
<?php
/*
* This file is part of the WebServiceBundle.
*
* (c) Christian Kerl <christian-kerl@web.de>
*
* 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 <christian-kerl@web.de>
*/
abstract class FileDumper implements DumperInterface
{
protected $file;
public function __construct($file)
{
Assert::thatArgumentNotNull('file', $file);
$this->file = $file;
}
}

View File

@ -22,11 +22,11 @@ use Zend\Soap\Wsdl;
*
* @author Christian Kerl <christian-kerl@web.de>
*/
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';