Skip to content

Commit

Permalink
Fix use of external classes
Browse files Browse the repository at this point in the history
  • Loading branch information
ctrlaltca committed Nov 27, 2016
1 parent 2e01a33 commit a8194b4
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 25 deletions.
23 changes: 11 additions & 12 deletions src/Wsdl.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ class Wsdl
*/
private $types;


/**
* A collection of SOAP operations
* @var array
Expand Down Expand Up @@ -119,7 +118,7 @@ protected function buildWsdl()
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:soap-enc="http://schemas.xmlsoap.org/soap/encoding/"></definitions>';

$dom = new DOMDocument();
$dom = new \DOMDocument();
$dom->loadXml($xml);
$this->definitions = $dom->documentElement;

Expand All @@ -135,9 +134,9 @@ protected function buildWsdl()

/**
* Adds complexType definitions to the document
* @param DomDocument $dom The document to add to
* @param DOMDocument $dom The document to add to
*/
public function addTypes(DomDocument $dom)
public function addTypes(\DOMDocument $dom)
{
if (!count($this->types)) return;
$types = $dom->createElementNS('http://schemas.xmlsoap.org/wsdl/', 'wsdl:types');
Expand Down Expand Up @@ -196,9 +195,9 @@ protected function getArrayTypePrefix($type)

/**
* Add messages for the service
* @param DomDocument $dom The document to add to
* @param DOMDocument $dom The document to add to
*/
protected function addMessages(DomDocument $dom)
protected function addMessages(\DOMDocument $dom)
{
foreach ($this->operations as $operation) {
$operation->setMessageElements($this->definitions, $dom);
Expand All @@ -207,9 +206,9 @@ protected function addMessages(DomDocument $dom)

/**
* Add the port types for the service
* @param DomDocument $dom The document to add to
* @param DOMDocument $dom The document to add to
*/
protected function addPortTypes(DOMDocument $dom)
protected function addPortTypes(\DOMDocument $dom)
{
$portType = $dom->createElementNS('http://schemas.xmlsoap.org/wsdl/', 'wsdl:portType');
$portType->setAttribute('name', $this->serviceName.'PortType');
Expand All @@ -223,9 +222,9 @@ protected function addPortTypes(DOMDocument $dom)

/**
* Add the bindings for the service
* @param DomDocument $dom The document to add to
* @param DOMDocument $dom The document to add to
*/
protected function addBindings(DOMDocument $dom)
protected function addBindings(\DOMDocument $dom)
{
$binding = $dom->createElementNS('http://schemas.xmlsoap.org/wsdl/', 'wsdl:binding');
$binding->setAttribute('name', $this->serviceName.'Binding');
Expand All @@ -246,9 +245,9 @@ protected function addBindings(DOMDocument $dom)

/**
* Add the service definition
* @param DomDocument $dom The document to add to
* @param DOMDocument $dom The document to add to
*/
protected function addService(DomDocument $dom)
protected function addService(\DOMDocument $dom)
{
$service = $dom->createElementNS('http://schemas.xmlsoap.org/wsdl/', 'wsdl:service');
$service->setAttribute('name', $this->serviceName.'Service');
Expand Down
6 changes: 3 additions & 3 deletions src/WsdlGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public function generateWsdl($className, $serviceUri='',$encoding='')
{
$this->wsdlDocument = new Wsdl($className, $serviceUri, $encoding);

$classReflect = new ReflectionClass($className);
$classReflect = new \ReflectionClass($className);
$methods = $classReflect->getMethods();

foreach ($methods as $method) {
Expand Down Expand Up @@ -129,7 +129,7 @@ public static function generate($className, $serviceUri='', $encoding='')
* Process a method found in the passed in class.
* @param ReflectionMethod $method The method to process
*/
protected function processMethod(ReflectionMethod $method)
protected function processMethod(\ReflectionMethod $method)
{
$comment = $method->getDocComment();
if (strpos($comment, '@soapmethod') === false) {
Expand Down Expand Up @@ -271,7 +271,7 @@ private function extractClassProperties($className)
* Using Reflection's DocComment to obtain property definitions
* DocComment is available since PHP 5.1
*/
$reflection = new ReflectionClass($className);
$reflection = new \ReflectionClass($className);
$properties = $reflection->getProperties();
foreach($properties as $property)
{
Expand Down
2 changes: 1 addition & 1 deletion src/WsdlMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public function getName()
* Return the message as a DOM element
* @param DOMDocument $wsdl The wsdl document the messages will be children of
*/
public function getMessageElement(DOMDocument $dom)
public function getMessageElement(\DOMDocument $dom)
{
$message = $dom->createElementNS('http://schemas.xmlsoap.org/wsdl/', 'wsdl:message');
$message->setAttribute('name', $this->name);
Expand Down
18 changes: 9 additions & 9 deletions src/WsdlOperation.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ public function setOutputMessage(WsdlMessage $msg)

/**
* Sets the message elements for this operation into the wsdl document
* @param DOMElement $wsdl The parent domelement for the messages
* @param DomDocument $dom The dom document to create the messages as children of
* @param \DOMElement $wsdl The parent domelement for the messages
* @param \DOMDocument $dom The dom document to create the messages as children of
*/
public function setMessageElements(DOMElement $wsdl, DOMDocument $dom)
public function setMessageElements(\DOMElement $wsdl, \DOMDocument $dom)
{

$input = $this->inputMessage->getMessageElement($dom);
Expand All @@ -78,10 +78,10 @@ public function setMessageElements(DOMElement $wsdl, DOMDocument $dom)

/**
* Get the port operations for this operation
* @param DomDocument $dom The dom document to create the messages as children of
* @return DomElement The dom element representing this port.
* @param \DOMDocument $dom The dom document to create the messages as children of
* @return \DOMElement The dom element representing this port.
*/
public function getPortOperation(DomDocument $dom)
public function getPortOperation(\DOMDocument $dom)
{
$operation = $dom->createElementNS('http://schemas.xmlsoap.org/wsdl/', 'wsdl:operation');
$operation->setAttribute('name', $this->operationName);
Expand All @@ -103,11 +103,11 @@ public function getPortOperation(DomDocument $dom)
* Build the binding operations.
* TODO: Still quite incomplete with all the things being stuck in, I don't understand
* a lot of it, and it's mostly copied from the output of nusoap's wsdl output.
* @param DomDocument $dom The dom document to create the binding as children of
* @param \DOMDocument $dom The dom document to create the binding as children of
* @param string $namespace The namespace this binding is in.
* @return DomElement The dom element representing this binding.
* @return \DOMElement The dom element representing this binding.
*/
public function getBindingOperation(DomDocument $dom, $namespace, $style='rpc')
public function getBindingOperation(\DOMDocument $dom, $namespace, $style='rpc')
{
$operation = $dom->createElementNS('http://schemas.xmlsoap.org/wsdl/', 'wsdl:operation');
$operation->setAttribute('name', $this->operationName);
Expand Down

0 comments on commit a8194b4

Please sign in to comment.