Skip to content

Commit

Permalink
add phpdoc and configuration of soap attachments
Browse files Browse the repository at this point in the history
  • Loading branch information
aschamberger committed Apr 29, 2012
1 parent 40a3bd5 commit 3183810
Showing 1 changed file with 54 additions and 5 deletions.
59 changes: 54 additions & 5 deletions src/BeSimple/SoapServer/SoapServerBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
namespace BeSimple\SoapServer;

use BeSimple\SoapCommon\AbstractSoapBuilder;
use BeSimple\SoapCommon\Helper;

/**
* SoapServerBuilder provides a fluent interface to configure and create a SoapServer instance.
Expand All @@ -28,13 +29,14 @@ class SoapServerBuilder extends AbstractSoapBuilder
protected $handlerObject;

/**
* @return SoapServerBuilder
* Create new instance with default options.
*
* @return \BeSimple\SoapServer\SoapServerBuilder
*/
static public function createWithDefaults()
{
return parent::createWithDefaults()
->withErrorReporting(false)
;
->withErrorReporting(false);
}

/**
Expand All @@ -48,6 +50,11 @@ public function __construct()
$this->withErrorReporting(false);
}

/**
* Finally returns a SoapClient instance.
*
* @return \BeSimple\SoapServer\SoapServer
*/
public function build()
{
$this->validateOptions();
Expand All @@ -69,13 +76,25 @@ public function build()
return $server;
}

/**
* Cofigures the SOAP actor.
*
* @param string $actor Actor name
*
* @return \BeSimple\SoapServer\SoapServerBuilder
*/
public function withActor($actor)
{
$this->options['actor'] = $actor;

return $this;
}

/**
* Enables persistence.
*
* @return \BeSimple\SoapServer\SoapServerBuilder
*/
public function withPersistanceRequest()
{
$this->persistence = SOAP_PERSISTENCE_REQUEST;
Expand All @@ -85,6 +104,8 @@ public function withPersistanceRequest()

/**
* Enables the HTTP session. The handler object is persisted between multiple requests in a session.
*
* @return \BeSimple\SoapServer\SoapServerBuilder
*/
public function withPersistenceSession()
{
Expand All @@ -96,7 +117,9 @@ public function withPersistenceSession()
/**
* Enables reporting of internal errors to clients. This should only be enabled in development environments.
*
* @param boolean $enable
* @param boolean $enable Enable error reporting
*
* @return \BeSimple\SoapServer\SoapServerBuilder
*/
public function withErrorReporting($enable = true)
{
Expand All @@ -105,25 +128,48 @@ public function withErrorReporting($enable = true)
return $this;
}

/**
* SOAP attachment type Base64.
*
* @return \BeSimple\SoapServer\SoapServerBuilder
*/
public function withBase64Attachments()
{
$this->options['attachment_type'] = Helper::ATTACHMENTS_TYPE_BASE64;

return $this;
}

/**
* SOAP attachment type SwA.
*
* @return \BeSimple\SoapServer\SoapServerBuilder
*/
public function withSwaAttachments()
{
$this->options['attachment_type'] = Helper::ATTACHMENTS_TYPE_SWA;

return $this;
}

/**
* SOAP attachment type MTOM.
*
* @return \BeSimple\SoapServer\SoapServerBuilder
*/
public function withMtomAttachments()
{
$this->options['attachment_type'] = Helper::ATTACHMENTS_TYPE_MTOM;

return $this;
}

/**
* Configures the handler class or object.
*
* @param mixed $handler Can be either a class name or an object.
*
* @return SoapServerBuilder
* @return \BeSimple\SoapServer\SoapServerBuilder
*/
public function withHandler($handler)
{
Expand All @@ -140,6 +186,9 @@ public function withHandler($handler)
return $this;
}

/**
* Validate options.
*/
protected function validateOptions()
{
$this->validateWsdl();
Expand Down

0 comments on commit 3183810

Please sign in to comment.