Skip to content
This repository has been archived by the owner on Jan 31, 2020. It is now read-only.

Commit

Permalink
Merge branch 'milestones/exceptions' of git://github.com/zendframewor…
Browse files Browse the repository at this point in the history
…k/zf2 into translator
  • Loading branch information
prolic committed Oct 10, 2010
3 parents 6f66646 + 12c90a3 + 5aac7b0 commit 435c161
Show file tree
Hide file tree
Showing 30 changed files with 1,021 additions and 335 deletions.
18 changes: 9 additions & 9 deletions src/AutoDiscover.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public function __construct($strategy = true, $uri=null, $wsdlClass=null)
public function setUri($uri)
{
if(!is_string($uri) && !($uri instanceof Uri\Uri)) {
throw new AutoDiscoverException(
throw new Exception\InvalidArgumentException(
'No uri given to \Zend\Soap\AutoDiscover::setUri as string or \Zend\Uri\Uri instance.'
);
}
Expand Down Expand Up @@ -165,7 +165,7 @@ public function getUri()
public function setWsdlClass($wsdlClass)
{
if(!is_string($wsdlClass) && !is_subclass_of($wsdlClass, 'Zend\Soap\Wsdl')) {
throw new AutoDiscoverException(
throw new Exception\InvalidArgumentException(
'No \Zend\Soap\Wsdl subclass given to Zend\Soap\AutoDiscover::setWsdlClass as string.'
);
}
Expand Down Expand Up @@ -196,7 +196,7 @@ public function getWsdlClass()
public function setOperationBodyStyle(array $operationStyle=array())
{
if(!isset($operationStyle['use'])) {
throw new AutoDiscoverException("Key 'use' is required in Operation soap:body style.");
throw new Exception\InvalidArgumentException("Key 'use' is required in Operation soap:body style.");
}
$this->_operationBodyStyle = $operationStyle;
return $this;
Expand Down Expand Up @@ -386,7 +386,7 @@ protected function _addFunctionToWsdl($function, $wsdl, $port, $binding)
}
}
if ($prototype === null) {
throw new AutoDiscoverException("No prototypes could be found for the '" . $function->getName() . "' function");
throw new Exception\InvalidArgumentException("No prototypes could be found for the '" . $function->getName() . "' function");
}

$functionName = Wsdl::translateType($function->getName());
Expand Down Expand Up @@ -482,7 +482,7 @@ protected function _addFunctionToWsdl($function, $wsdl, $port, $binding)
*/
public function fault($fault = null, $code = null)
{
throw new AutoDiscoverException('Function has no use in AutoDiscover.');
throw new Exception\UnexpectedValueException('Function has no use in AutoDiscover.');
}

/**
Expand All @@ -508,7 +508,7 @@ public function dump($filename)
if($this->_wsdl !== null) {
return $this->_wsdl->dump($filename);
} else {
throw new AutoDiscoverException('Cannot dump autodiscovered contents, WSDL file has not been generated yet.');
throw new Exception\RuntimeException('Cannot dump autodiscovered contents, WSDL file has not been generated yet.');
}
}

Expand All @@ -520,7 +520,7 @@ public function toXml()
if($this->_wsdl !== null) {
return $this->_wsdl->toXml();
} else {
throw new AutoDiscoverException('Cannot return autodiscovered contents, WSDL file has not been generated yet.');
throw new Exception\RuntimeException('Cannot return autodiscovered contents, WSDL file has not been generated yet.');
}
}

Expand All @@ -541,7 +541,7 @@ public function getFunctions()
*/
public function loadFunctions($definition)
{
throw new AutoDiscoverException('Function has no use in AutoDiscover.');
throw new Exception\RuntimeException('Function has no use in AutoDiscover.');
}

/**
Expand All @@ -551,7 +551,7 @@ public function loadFunctions($definition)
*/
public function setPersistence($mode)
{
throw new AutoDiscoverException('Function has no use in AutoDiscover.');
throw new Exception\RuntimeException('Function has no use in AutoDiscover.');
}

/**
Expand Down
30 changes: 15 additions & 15 deletions src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ class Client
public function __construct($wsdl = null, $options = null)
{
if (!extension_loaded('soap')) {
throw new ClientException('SOAP extension is not loaded.');
throw new Exception\ExtensionNotLoadedException('SOAP extension is not loaded.');
}

if ($wsdl !== null) {
Expand Down Expand Up @@ -269,7 +269,7 @@ public function setOptions($options)
// break;

default:
throw new ClientException('Unknown SOAP client option');
throw new Exception\InvalidArgumentException('Unknown SOAP client option');
break;
}
}
Expand Down Expand Up @@ -338,7 +338,7 @@ public function getOptions()
public function setSoapVersion($version)
{
if (!in_array($version, array(SOAP_1_1, SOAP_1_2))) {
throw new ClientException('Invalid soap version specified. Use SOAP_1_1 or SOAP_1_2 constants.');
throw new Exception\InvalidArgumentException('Invalid soap version specified. Use SOAP_1_1 or SOAP_1_2 constants.');
}
$this->_soapVersion = $version;

Expand Down Expand Up @@ -368,7 +368,7 @@ public function setClassmap(array $classmap)
{
foreach ($classmap as $type => $class) {
if (!class_exists($class)) {
throw new ClientException('Invalid class in class map');
throw new Exception\InvalidArgumentException('Invalid class in class map');
}
}

Expand Down Expand Up @@ -430,7 +430,7 @@ public function validateUrn($urn)
{
$scheme = parse_url($urn, PHP_URL_SCHEME);
if ($scheme === false || $scheme === null) {
throw new ClientException('Invalid URN');
throw new Exception\InvalidArgumentException('Invalid URN');
}

return true;
Expand Down Expand Up @@ -505,7 +505,7 @@ public function getLocation()
public function setStyle($style)
{
if (!in_array($style, array(SOAP_RPC, SOAP_DOCUMENT))) {
throw new ClientException('Invalid request style specified. Use SOAP_RPC or SOAP_DOCUMENT constants.');
throw new Exception\InvalidArgumentException('Invalid request style specified. Use SOAP_RPC or SOAP_DOCUMENT constants.');
}

$this->_style = $style;
Expand Down Expand Up @@ -535,7 +535,7 @@ public function getStyle()
public function setEncodingMethod($use)
{
if (!in_array($use, array(SOAP_ENCODED, SOAP_LITERAL))) {
throw new ClientException('Invalid message encoding method. Use SOAP_ENCODED or SOAP_LITERAL constants.');
throw new Exception\InvalidArgumentException('Invalid message encoding method. Use SOAP_ENCODED or SOAP_LITERAL constants.');
}

$this->_use = $use;
Expand Down Expand Up @@ -705,7 +705,7 @@ public function setProxyPassword($proxyPassword)
public function setHttpsCertificate($localCert)
{
if (!is_readable($localCert)) {
throw new ClientException('Invalid HTTPS client certificate path.');
throw new Exception\InvalidArgumentException('Invalid HTTPS client certificate path.');
}

$this->_local_cert = $localCert;
Expand Down Expand Up @@ -793,7 +793,7 @@ public function getProxyPassword()
public function setStreamContext($context)
{
if(!is_resource($context) || get_resource_type($context) !== "stream-context") {
throw new ClientException('Invalid stream context resource given.');
throw new Exception\InvalidArgumentException('Invalid stream context resource given.');
}

$this->_stream_context = $context;
Expand Down Expand Up @@ -981,17 +981,17 @@ protected function _initSoapClientObject()

if ($wsdl == null) {
if (!isset($options['location'])) {
throw new ClientException('\'location\' parameter is required in non-WSDL mode.');
throw new Exception\UnexpectedValueException('\'location\' parameter is required in non-WSDL mode.');
}
if (!isset($options['uri'])) {
throw new ClientException('\'uri\' parameter is required in non-WSDL mode.');
throw new Exception\UnexpectedValueException('\'uri\' parameter is required in non-WSDL mode.');
}
} else {
if (isset($options['use'])) {
throw new ClientException('\'use\' parameter only works in non-WSDL mode.');
throw new Exception\UnexpectedValueException('\'use\' parameter only works in non-WSDL mode.');
}
if (isset($options['style'])) {
throw new ClientException('\'style\' parameter only works in non-WSDL mode.');
throw new Exception\UnexpectedValueException('\'style\' parameter only works in non-WSDL mode.');
}
}
unset($options['wsdl']);
Expand Down Expand Up @@ -1103,7 +1103,7 @@ public function __call($name, $arguments)
public function getFunctions()
{
if ($this->getWSDL() == null) {
throw new ClientException('\'getFunctions\' method is available only in WSDL mode.');
throw new Exception\UnexpectedValueException(__METHOD__ . ' is available only in WSDL mode.');
}

$soapClient = $this->getSoapClient();
Expand All @@ -1126,7 +1126,7 @@ public function getFunctions()
public function getTypes()
{
if ($this->getWSDL() == null) {
throw new ClientException('\'getTypes\' method is available only in WSDL mode.');
throw new Exception\UnexpectedValueException(__METHOD__ . ' method is available only in WSDL mode.');
}

$soapClient = $this->getSoapClient();
Expand Down
4 changes: 2 additions & 2 deletions src/Client/DotNet.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
namespace Zend\Soap\Client;

use Zend\Soap\Client as SOAPClient,
Zend\Soap\ClientException;
Zend\Soap\Exception;

/**
* .NET SOAP client
Expand Down Expand Up @@ -73,7 +73,7 @@ protected function _preProcessArguments($arguments)
if (count($arguments) > 1 ||
(count($arguments) == 1 && !is_array(reset($arguments)))
) {
throw new ClientException('.Net webservice arguments have to be grouped into array: array(\'a\' => $a, \'b\' => $b, ...).');
throw new Exception\RuntimeException('.Net webservice arguments have to be grouped into array: array(\'a\' => $a, \'b\' => $b, ...).');
}

// Do nothing
Expand Down
38 changes: 0 additions & 38 deletions src/ClientException.php

This file was deleted.

2 changes: 1 addition & 1 deletion src/Exception.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@
* @package Zend_Soap
* @subpackage AutoDiscover
*/
class Exception extends \Zend\Exception
interface Exception
{
}
File renamed without changes.
9 changes: 9 additions & 0 deletions src/Exception/ExceptionNotLoadedException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

namespace Zend\Soap\Exception;

class ExtensionNotLoadedException
extends \RuntimeException
implements \Zend\Soap\Exception
{
}
9 changes: 9 additions & 0 deletions src/Exception/InvalidArgumentException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

namespace Zend\Soap\Exception;

class InvalidArgumentException
extends \InvalidArgumentException
implements \Zend\Soap\Exception
{
}
10 changes: 10 additions & 0 deletions src/Exception/RuntimeException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

namespace Zend\Soap\Exception;

class RuntimeException
extends \RuntimeException
implements \Zend\Soap\Exception
{

}
File renamed without changes.
10 changes: 10 additions & 0 deletions src/Exception/UnexpectedValueException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

namespace Zend\Soap\Exception;

class UnexpectedValueException
extends \UnexpectedValueException
implements \Zend\Soap\Exception
{

}
File renamed without changes.
Loading

0 comments on commit 435c161

Please sign in to comment.