summaryrefslogtreecommitdiffstats
path: root/library/vendor/Zend/Soap/Wsdl
diff options
context:
space:
mode:
Diffstat (limited to 'library/vendor/Zend/Soap/Wsdl')
-rw-r--r--library/vendor/Zend/Soap/Wsdl/Exception.php36
-rw-r--r--library/vendor/Zend/Soap/Wsdl/Strategy/Abstract.php65
-rw-r--r--library/vendor/Zend/Soap/Wsdl/Strategy/AnyType.php58
-rw-r--r--library/vendor/Zend/Soap/Wsdl/Strategy/ArrayOfTypeComplex.php142
-rw-r--r--library/vendor/Zend/Soap/Wsdl/Strategy/ArrayOfTypeSequence.php154
-rw-r--r--library/vendor/Zend/Soap/Wsdl/Strategy/Composite.php183
-rw-r--r--library/vendor/Zend/Soap/Wsdl/Strategy/DefaultComplexType.php89
-rw-r--r--library/vendor/Zend/Soap/Wsdl/Strategy/Interface.php48
8 files changed, 775 insertions, 0 deletions
diff --git a/library/vendor/Zend/Soap/Wsdl/Exception.php b/library/vendor/Zend/Soap/Wsdl/Exception.php
new file mode 100644
index 0000000..11397f0
--- /dev/null
+++ b/library/vendor/Zend/Soap/Wsdl/Exception.php
@@ -0,0 +1,36 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Soap
+ * @subpackage Wsdl
+ * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id$
+ */
+
+/**
+ * @see Zend_Exception
+ */
+
+/**
+ * Zend_Soap_Wsdl_Exception
+ *
+ * @category Zend
+ * @package Zend_Soap
+ * @subpackage Wsdl
+ * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+class Zend_Soap_Wsdl_Exception extends Zend_Exception { }
diff --git a/library/vendor/Zend/Soap/Wsdl/Strategy/Abstract.php b/library/vendor/Zend/Soap/Wsdl/Strategy/Abstract.php
new file mode 100644
index 0000000..35f198f
--- /dev/null
+++ b/library/vendor/Zend/Soap/Wsdl/Strategy/Abstract.php
@@ -0,0 +1,65 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Soap
+ * @subpackage Wsdl
+ * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id$
+ */
+
+/**
+ * @see Zend_Soap_Wsdl_Strategy_Interface
+ */
+
+/**
+ * Abstract class for Zend_Soap_Wsdl_Strategy.
+ *
+ * @category Zend
+ * @package Zend_Soap
+ * @subpackage Wsdl
+ * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+abstract class Zend_Soap_Wsdl_Strategy_Abstract implements Zend_Soap_Wsdl_Strategy_Interface
+{
+ /**
+ * Context object
+ *
+ * @var Zend_Soap_Wsdl
+ */
+ protected $_context;
+
+ /**
+ * Set the Zend_Soap_Wsdl Context object this strategy resides in.
+ *
+ * @param Zend_Soap_Wsdl $context
+ * @return void
+ */
+ public function setContext(Zend_Soap_Wsdl $context)
+ {
+ $this->_context = $context;
+ }
+
+ /**
+ * Return the current Zend_Soap_Wsdl context object
+ *
+ * @return Zend_Soap_Wsdl
+ */
+ public function getContext()
+ {
+ return $this->_context;
+ }
+}
diff --git a/library/vendor/Zend/Soap/Wsdl/Strategy/AnyType.php b/library/vendor/Zend/Soap/Wsdl/Strategy/AnyType.php
new file mode 100644
index 0000000..13f352e
--- /dev/null
+++ b/library/vendor/Zend/Soap/Wsdl/Strategy/AnyType.php
@@ -0,0 +1,58 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Soap
+ * @subpackage Wsdl
+ * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id$
+ */
+
+/**
+ * @see Zend_Soap_Wsdl_Strategy_Interface
+ */
+
+/**
+ * Zend_Soap_Wsdl_Strategy_AnyType
+ *
+ * @category Zend
+ * @package Zend_Soap
+ * @subpackage Wsdl
+ * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+class Zend_Soap_Wsdl_Strategy_AnyType implements Zend_Soap_Wsdl_Strategy_Interface
+{
+ /**
+ * Not needed in this strategy.
+ *
+ * @param Zend_Soap_Wsdl $context
+ */
+ public function setContext(Zend_Soap_Wsdl $context)
+ {
+
+ }
+
+ /**
+ * Returns xsd:anyType regardless of the input.
+ *
+ * @param string $type
+ * @return string
+ */
+ public function addComplexType($type)
+ {
+ return 'xsd:anyType';
+ }
+}
diff --git a/library/vendor/Zend/Soap/Wsdl/Strategy/ArrayOfTypeComplex.php b/library/vendor/Zend/Soap/Wsdl/Strategy/ArrayOfTypeComplex.php
new file mode 100644
index 0000000..a830840
--- /dev/null
+++ b/library/vendor/Zend/Soap/Wsdl/Strategy/ArrayOfTypeComplex.php
@@ -0,0 +1,142 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Soap
+ * @subpackage Wsdl
+ * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id$
+ */
+
+/**
+ * @see Zend_Soap_Wsdl_Strategy_DefaultComplexType
+ */
+
+/**
+ * Zend_Soap_Wsdl_Strategy_ArrayOfTypeComplex
+ *
+ * @category Zend
+ * @package Zend_Soap
+ * @subpackage Wsdl
+ * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+class Zend_Soap_Wsdl_Strategy_ArrayOfTypeComplex extends Zend_Soap_Wsdl_Strategy_DefaultComplexType
+{
+ protected $_inProcess = array();
+
+ /**
+ * Add an ArrayOfType based on the xsd:complexType syntax if type[] is detected in return value doc comment.
+ *
+ * @param string $type
+ * @return string tns:xsd-type
+ */
+ public function addComplexType($type)
+ {
+ if (in_array($type, $this->_inProcess)) {
+ return "tns:" . $type;
+ }
+ $this->_inProcess[$type] = $type;
+
+ $nestingLevel = $this->_getNestedCount($type);
+
+ if($nestingLevel > 1) {
+ throw new Zend_Soap_Wsdl_Exception(
+ "ArrayOfTypeComplex cannot return nested ArrayOfObject deeper than ".
+ "one level. Use array object properties to return deep nested data.
+ ");
+ }
+
+ $singularType = $this->_getSingularPhpType($type);
+
+ if(!class_exists($singularType)) {
+ throw new Zend_Soap_Wsdl_Exception(sprintf(
+ "Cannot add a complex type %s that is not an object or where ".
+ "class could not be found in 'DefaultComplexType' strategy.", $type
+ ));
+ }
+
+ if($nestingLevel == 1) {
+ // The following blocks define the Array of Object structure
+ $xsdComplexTypeName = $this->_addArrayOfComplexType($singularType, $type);
+ } else {
+ $xsdComplexTypeName = $singularType;
+ }
+
+ // The array for the objects has been created, now build the object definition:
+ if(!in_array($singularType, $this->getContext()->getTypes())) {
+ parent::addComplexType($singularType);
+ }
+
+ unset($this->_inProcess[$type]);
+ return "tns:".$xsdComplexTypeName;
+ }
+
+ protected function _addArrayOfComplexType($singularType, $type)
+ {
+ $dom = $this->getContext()->toDomDocument();
+
+ $xsdComplexTypeName = $this->_getXsdComplexTypeName($singularType);
+
+ if(!in_array($xsdComplexTypeName, $this->getContext()->getTypes())) {
+ $complexType = $dom->createElement('xsd:complexType');
+ $complexType->setAttribute('name', $xsdComplexTypeName);
+
+ $complexContent = $dom->createElement("xsd:complexContent");
+ $complexType->appendChild($complexContent);
+
+ $xsdRestriction = $dom->createElement("xsd:restriction");
+ $xsdRestriction->setAttribute('base', 'soap-enc:Array');
+ $complexContent->appendChild($xsdRestriction);
+
+ $xsdAttribute = $dom->createElement("xsd:attribute");
+ $xsdAttribute->setAttribute("ref", "soap-enc:arrayType");
+ $xsdAttribute->setAttribute("wsdl:arrayType", sprintf("tns:%s[]", $singularType));
+ $xsdRestriction->appendChild($xsdAttribute);
+
+ $this->getContext()->getSchema()->appendChild($complexType);
+ $this->getContext()->addType($xsdComplexTypeName);
+ }
+
+ return $xsdComplexTypeName;
+ }
+
+ protected function _getXsdComplexTypeName($type)
+ {
+ return sprintf('ArrayOf%s', $type);
+ }
+
+ /**
+ * From a nested definition with type[], get the singular PHP Type
+ *
+ * @param string $type
+ * @return string
+ */
+ protected function _getSingularPhpType($type)
+ {
+ return str_replace("[]", "", $type);
+ }
+
+ /**
+ * Return the array nesting level based on the type name
+ *
+ * @param string $type
+ * @return integer
+ */
+ protected function _getNestedCount($type)
+ {
+ return substr_count($type, "[]");
+ }
+}
diff --git a/library/vendor/Zend/Soap/Wsdl/Strategy/ArrayOfTypeSequence.php b/library/vendor/Zend/Soap/Wsdl/Strategy/ArrayOfTypeSequence.php
new file mode 100644
index 0000000..e82ea50
--- /dev/null
+++ b/library/vendor/Zend/Soap/Wsdl/Strategy/ArrayOfTypeSequence.php
@@ -0,0 +1,154 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Soap
+ * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id$
+ */
+
+/**
+ * @see Zend_Soap_Wsdl_Strategy_DefaultComplexType
+ */
+
+/**
+ * Zend_Soap_Wsdl_Strategy_ArrayOfTypeSequence
+ *
+ * @category Zend
+ * @package Zend_Soap
+ * @subpackage Wsdl
+ * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+class Zend_Soap_Wsdl_Strategy_ArrayOfTypeSequence extends Zend_Soap_Wsdl_Strategy_DefaultComplexType
+{
+ /**
+ * Add an unbounded ArrayOfType based on the xsd:sequence syntax if type[] is detected in return value doc comment.
+ *
+ * @param string $type
+ * @return string tns:xsd-type
+ */
+ public function addComplexType($type)
+ {
+ $nestedCounter = $this->_getNestedCount($type);
+
+ if($nestedCounter > 0) {
+ $singularType = $this->_getSingularType($type);
+
+ for($i = 1; $i <= $nestedCounter; $i++) {
+ $complexTypeName = substr($this->_getTypeNameBasedOnNestingLevel($singularType, $i), 4);
+ $childTypeName = $this->_getTypeNameBasedOnNestingLevel($singularType, $i-1);
+
+ $this->_addElementFromWsdlAndChildTypes($complexTypeName, $childTypeName);
+ }
+ // adding the PHP type which is resolved to a nested XSD type. therefore add only once.
+ $this->getContext()->addType($complexTypeName);
+
+ return "tns:$complexTypeName";
+ } else if (!in_array($type, $this->getContext()->getTypes())) {
+ // New singular complex type
+ return parent::addComplexType($type);
+ } else {
+ // Existing complex type
+ return $this->getContext()->getType($type);
+ }
+ }
+
+ /**
+ * Return the ArrayOf or simple type name based on the singular xsdtype and the nesting level
+ *
+ * @param string $singularType
+ * @param int $level
+ * @return string
+ */
+ protected function _getTypeNameBasedOnNestingLevel($singularType, $level)
+ {
+ if($level == 0) {
+ // This is not an Array anymore, return the xsd simple type
+ return $singularType;
+ } else {
+ $prefix = str_repeat("ArrayOf", $level);
+ $xsdType = $this->_getStrippedXsdType($singularType);
+ $arrayType = $prefix.$xsdType;
+ return "tns:$arrayType";
+ }
+ }
+
+ /**
+ * Strip the xsd: from a singularType and Format it nice for ArrayOf<Type> naming
+ *
+ * @param string $singularType
+ * @return string
+ */
+ protected function _getStrippedXsdType($singularType)
+ {
+ return ucfirst(substr(strtolower($singularType), 4));
+ }
+
+ /**
+ * From a nested defintion with type[], get the singular xsd:type
+ *
+ * @throws Zend_Soap_Wsdl_Exception When no xsd:simpletype can be detected.
+ * @param string $type
+ * @return string
+ */
+ protected function _getSingularType($type)
+ {
+ $singulartype = $this->getContext()->getType(str_replace("[]", "", $type));
+ return $singulartype;
+ }
+
+ /**
+ * Return the array nesting level based on the type name
+ *
+ * @param string $type
+ * @return integer
+ */
+ protected function _getNestedCount($type)
+ {
+ return substr_count($type, "[]");
+ }
+
+ /**
+ * Append the complex type definition to the WSDL via the context access
+ *
+ * @param string $arrayType
+ * @param string $childTypeName
+ * @return void
+ */
+ protected function _addElementFromWsdlAndChildTypes($arrayType, $childTypeName)
+ {
+ if (!in_array($arrayType, $this->getContext()->getTypes())) {
+ $dom = $this->getContext()->toDomDocument();
+
+ $complexType = $dom->createElement('xsd:complexType');
+ $complexType->setAttribute('name', $arrayType);
+
+ $sequence = $dom->createElement('xsd:sequence');
+
+ $element = $dom->createElement('xsd:element');
+ $element->setAttribute('name', 'item');
+ $element->setAttribute('type', $childTypeName);
+ $element->setAttribute('minOccurs', 0);
+ $element->setAttribute('maxOccurs', 'unbounded');
+ $sequence->appendChild($element);
+
+ $complexType->appendChild($sequence);
+
+ $this->getContext()->getSchema()->appendChild($complexType);
+ $this->getContext()->addType($arrayType);
+ }
+ }
+}
diff --git a/library/vendor/Zend/Soap/Wsdl/Strategy/Composite.php b/library/vendor/Zend/Soap/Wsdl/Strategy/Composite.php
new file mode 100644
index 0000000..a80120e
--- /dev/null
+++ b/library/vendor/Zend/Soap/Wsdl/Strategy/Composite.php
@@ -0,0 +1,183 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Soap
+ * @subpackage Wsdl
+ * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id$
+ */
+
+/**
+ * @see Zend_Soap_Wsdl_Strategy_Interface
+ */
+
+/**
+ * Zend_Soap_Wsdl_Strategy_Composite
+ *
+ * @category Zend
+ * @package Zend_Soap
+ * @subpackage Wsdl
+ * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+class Zend_Soap_Wsdl_Strategy_Composite implements Zend_Soap_Wsdl_Strategy_Interface
+{
+ /**
+ * Typemap of Complex Type => Strategy pairs.
+ *
+ * @var array
+ */
+ protected $_typeMap = array();
+
+ /**
+ * Default Strategy of this composite
+ *
+ * @var string|Zend_Soap_Wsdl_Strategy_Interface
+ */
+ protected $_defaultStrategy;
+
+ /**
+ * Context WSDL file that this composite serves
+ *
+ * @var Zend_Soap_Wsdl|null
+ */
+ protected $_context;
+
+ /**
+ * Construct Composite WSDL Strategy.
+ *
+ * @throws Zend_Soap_Wsdl_Exception
+ * @param array $typeMap
+ * @param string|Zend_Soap_Wsdl_Strategy_Interface $defaultStrategy
+ */
+ public function __construct(array $typeMap=array(), $defaultStrategy="Zend_Soap_Wsdl_Strategy_DefaultComplexType")
+ {
+ foreach($typeMap AS $type => $strategy) {
+ $this->connectTypeToStrategy($type, $strategy);
+ }
+ $this->_defaultStrategy = $defaultStrategy;
+ }
+
+ /**
+ * Connect a complex type to a given strategy.
+ *
+ * @throws Zend_Soap_Wsdl_Exception
+ * @param string $type
+ * @param string|Zend_Soap_Wsdl_Strategy_Interface $strategy
+ * @return Zend_Soap_Wsdl_Strategy_Composite
+ */
+ public function connectTypeToStrategy($type, $strategy)
+ {
+ if(!is_string($type)) {
+ /**
+ * @see Zend_Soap_Wsdl_Exception
+ */
+ throw new Zend_Soap_Wsdl_Exception("Invalid type given to Composite Type Map.");
+ }
+ $this->_typeMap[$type] = $strategy;
+ return $this;
+ }
+
+ /**
+ * Return default strategy of this composite
+ *
+ * @throws Zend_Soap_Wsdl_Exception
+ * @param string $type
+ * @return Zend_Soap_Wsdl_Strategy_Interface
+ */
+ public function getDefaultStrategy()
+ {
+ $strategy = $this->_defaultStrategy;
+ if(is_string($strategy) && class_exists($strategy)) {
+ $strategy = new $strategy;
+ }
+ if( !($strategy instanceof Zend_Soap_Wsdl_Strategy_Interface) ) {
+ /**
+ * @see Zend_Soap_Wsdl_Exception
+ */
+ throw new Zend_Soap_Wsdl_Exception(
+ "Default Strategy for Complex Types is not a valid strategy object."
+ );
+ }
+ $this->_defaultStrategy = $strategy;
+ return $strategy;
+ }
+
+ /**
+ * Return specific strategy or the default strategy of this type.
+ *
+ * @throws Zend_Soap_Wsdl_Exception
+ * @param string $type
+ * @return Zend_Soap_Wsdl_Strategy_Interface
+ */
+ public function getStrategyOfType($type)
+ {
+ if(isset($this->_typeMap[$type])) {
+ $strategy = $this->_typeMap[$type];
+
+ if(is_string($strategy) && class_exists($strategy)) {
+ $strategy = new $strategy();
+ }
+
+ if( !($strategy instanceof Zend_Soap_Wsdl_Strategy_Interface) ) {
+ /**
+ * @see Zend_Soap_Wsdl_Exception
+ */
+ throw new Zend_Soap_Wsdl_Exception(
+ "Strategy for Complex Type '".$type."' is not a valid strategy object."
+ );
+ }
+ $this->_typeMap[$type] = $strategy;
+ } else {
+ $strategy = $this->getDefaultStrategy();
+ }
+ return $strategy;
+ }
+
+ /**
+ * Method accepts the current WSDL context file.
+ *
+ * @param Zend_Soap_Wsdl $context
+ */
+ public function setContext(Zend_Soap_Wsdl $context)
+ {
+ $this->_context = $context;
+ return $this;
+ }
+
+ /**
+ * Create a complex type based on a strategy
+ *
+ * @throws Zend_Soap_Wsdl_Exception
+ * @param string $type
+ * @return string XSD type
+ */
+ public function addComplexType($type)
+ {
+ if(!($this->_context instanceof Zend_Soap_Wsdl) ) {
+ /**
+ * @see Zend_Soap_Wsdl_Exception
+ */
+ throw new Zend_Soap_Wsdl_Exception(
+ "Cannot add complex type '".$type."', no context is set for this composite strategy."
+ );
+ }
+
+ $strategy = $this->getStrategyOfType($type);
+ $strategy->setContext($this->_context);
+ return $strategy->addComplexType($type);
+ }
+}
diff --git a/library/vendor/Zend/Soap/Wsdl/Strategy/DefaultComplexType.php b/library/vendor/Zend/Soap/Wsdl/Strategy/DefaultComplexType.php
new file mode 100644
index 0000000..3baf804
--- /dev/null
+++ b/library/vendor/Zend/Soap/Wsdl/Strategy/DefaultComplexType.php
@@ -0,0 +1,89 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Soap
+ * @subpackage Wsdl
+ * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id$
+ */
+
+/**
+ * @see Zend_Soap_Wsdl_Strategy_Abstract
+ */
+
+/**
+ * Zend_Soap_Wsdl_Strategy_DefaultComplexType
+ *
+ * @category Zend
+ * @package Zend_Soap
+ * @subpackage Wsdl
+ * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+class Zend_Soap_Wsdl_Strategy_DefaultComplexType extends Zend_Soap_Wsdl_Strategy_Abstract
+{
+ /**
+ * Add a complex type by recursivly using all the class properties fetched via Reflection.
+ *
+ * @param string $type Name of the class to be specified
+ * @return string XSD Type for the given PHP type
+ */
+ public function addComplexType($type)
+ {
+ if(!class_exists($type)) {
+ throw new Zend_Soap_Wsdl_Exception(sprintf(
+ "Cannot add a complex type %s that is not an object or where ".
+ "class could not be found in 'DefaultComplexType' strategy.", $type
+ ));
+ }
+
+ $dom = $this->getContext()->toDomDocument();
+ $class = new ReflectionClass($type);
+
+ $defaultProperties = $class->getDefaultProperties();
+
+ $complexType = $dom->createElement('xsd:complexType');
+ $complexType->setAttribute('name', $type);
+
+ $all = $dom->createElement('xsd:all');
+
+ foreach ($class->getProperties() as $property) {
+ if ($property->isPublic() && preg_match_all('/@var\s+([^\s]+)/m', $property->getDocComment(), $matches)) {
+
+ /**
+ * @todo check if 'xsd:element' must be used here (it may not be compatible with using 'complexType'
+ * node for describing other classes used as attribute types for current class
+ */
+ $element = $dom->createElement('xsd:element');
+ $element->setAttribute('name', $propertyName = $property->getName());
+ $element->setAttribute('type', $this->getContext()->getType(trim($matches[1][0])));
+
+ // If the default value is null, then this property is nillable.
+ if ($defaultProperties[$propertyName] === null) {
+ $element->setAttribute('nillable', 'true');
+ }
+
+ $all->appendChild($element);
+ }
+ }
+
+ $complexType->appendChild($all);
+ $this->getContext()->getSchema()->appendChild($complexType);
+ $this->getContext()->addType($type);
+
+ return "tns:$type";
+ }
+}
diff --git a/library/vendor/Zend/Soap/Wsdl/Strategy/Interface.php b/library/vendor/Zend/Soap/Wsdl/Strategy/Interface.php
new file mode 100644
index 0000000..9a57605
--- /dev/null
+++ b/library/vendor/Zend/Soap/Wsdl/Strategy/Interface.php
@@ -0,0 +1,48 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Soap
+ * @subpackage Wsdl
+ * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id$
+ */
+
+/**
+ * Interface for Zend_Soap_Wsdl_Strategy.
+ *
+ * @category Zend
+ * @package Zend_Soap
+ * @subpackage Wsdl
+ * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+interface Zend_Soap_Wsdl_Strategy_Interface
+{
+ /**
+ * Method accepts the current WSDL context file.
+ *
+ * @param <type> $context
+ */
+ public function setContext(Zend_Soap_Wsdl $context);
+
+ /**
+ * Create a complex type based on a strategy
+ *
+ * @param string $type
+ * @return string XSD type
+ */
+ public function addComplexType($type);
+}