2010-10-07 15:16:56 +02:00
|
|
|
<?php
|
2010-10-08 17:01:27 +02:00
|
|
|
/*
|
2011-07-18 22:43:12 +02:00
|
|
|
* This file is part of the BeSimpleSoapBundle.
|
2010-10-08 17:01:27 +02:00
|
|
|
*
|
|
|
|
* (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.
|
|
|
|
*/
|
2010-10-07 15:16:56 +02:00
|
|
|
|
2011-07-18 22:43:12 +02:00
|
|
|
namespace BeSimple\SoapBundle\ServiceDefinition;
|
2010-10-07 15:16:56 +02:00
|
|
|
|
2011-07-18 22:43:12 +02:00
|
|
|
use BeSimple\SoapBundle\Util\Collection;
|
2011-11-26 12:18:29 +01:00
|
|
|
use BeSimple\SoapCommon\Classmap;
|
2010-10-07 15:16:56 +02:00
|
|
|
|
|
|
|
class ServiceDefinition
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
private $name;
|
|
|
|
|
2011-02-03 01:04:12 +01:00
|
|
|
/**
|
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
private $namespace;
|
|
|
|
|
2010-10-07 15:16:56 +02:00
|
|
|
/**
|
2011-07-18 22:43:12 +02:00
|
|
|
* @var \BeSimple\SoapBundle\Util\Collection
|
2010-10-07 15:16:56 +02:00
|
|
|
*/
|
|
|
|
private $methods;
|
|
|
|
|
2011-11-26 12:18:29 +01:00
|
|
|
/**
|
|
|
|
* @var \BeSimple\SoapCommon\Classmap
|
|
|
|
*/
|
|
|
|
private $classmap;
|
|
|
|
|
2011-07-23 20:06:42 +02:00
|
|
|
private $complexTypes = array();
|
|
|
|
|
2011-11-26 12:18:29 +01:00
|
|
|
public function __construct($name = null, $namespace = null, array $methods = array(), Classmap $classmap = null)
|
2010-10-07 15:16:56 +02:00
|
|
|
{
|
|
|
|
$this->setName($name);
|
2011-02-03 01:04:12 +01:00
|
|
|
$this->setNamespace($namespace);
|
2011-07-17 10:46:54 +02:00
|
|
|
|
2011-07-18 22:43:12 +02:00
|
|
|
$this->methods = new Collection('getName', 'BeSimple\SoapBundle\ServiceDefinition\Method');
|
2010-10-07 15:16:56 +02:00
|
|
|
$this->setMethods($methods);
|
2011-11-26 12:18:29 +01:00
|
|
|
|
|
|
|
$this->classmap = $classmap;
|
2010-10-07 15:16:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function getName()
|
|
|
|
{
|
|
|
|
return $this->name;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param string $name
|
|
|
|
*/
|
|
|
|
public function setName($name)
|
|
|
|
{
|
|
|
|
$this->name = $name;
|
|
|
|
}
|
|
|
|
|
2011-02-03 01:04:12 +01:00
|
|
|
/**
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function getNamespace()
|
|
|
|
{
|
|
|
|
return $this->namespace;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param string $namespace
|
|
|
|
*/
|
|
|
|
public function setNamespace($namespace)
|
|
|
|
{
|
|
|
|
$this->namespace = $namespace;
|
|
|
|
}
|
|
|
|
|
2010-10-07 15:16:56 +02:00
|
|
|
/**
|
2011-07-18 22:43:12 +02:00
|
|
|
* @return \BeSimple\SoapBundle\Util\Collection
|
2010-10-07 15:16:56 +02:00
|
|
|
*/
|
|
|
|
public function getMethods()
|
|
|
|
{
|
|
|
|
return $this->methods;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param array $methods
|
|
|
|
*/
|
2011-07-17 10:46:54 +02:00
|
|
|
public function setMethods(array $methods)
|
2010-10-07 15:16:56 +02:00
|
|
|
{
|
|
|
|
$this->methods->addAll($methods);
|
|
|
|
}
|
|
|
|
|
2011-07-17 15:08:46 +02:00
|
|
|
/**
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
public function getAllTypes()
|
|
|
|
{
|
|
|
|
$types = array();
|
|
|
|
|
2011-08-14 18:00:28 +02:00
|
|
|
foreach ($this->methods as $method) {
|
|
|
|
foreach ($method->getArguments() as $argument) {
|
2011-07-17 15:08:46 +02:00
|
|
|
$types[] = $argument->getType();
|
|
|
|
}
|
|
|
|
|
2011-08-14 18:00:28 +02:00
|
|
|
foreach ($method->getHeaders() as $header) {
|
|
|
|
$types[] = $header->getType();
|
|
|
|
}
|
|
|
|
|
2011-07-17 15:08:46 +02:00
|
|
|
$types[] = $method->getReturn();
|
|
|
|
}
|
|
|
|
|
|
|
|
return $types;
|
|
|
|
}
|
2011-07-23 20:06:42 +02:00
|
|
|
|
2011-11-26 12:18:29 +01:00
|
|
|
public function getClassmap()
|
|
|
|
{
|
|
|
|
return $this->classmap ?: array();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setClassmap(Classmap $classmap)
|
|
|
|
{
|
|
|
|
$this->classmap = $classmap;
|
|
|
|
}
|
|
|
|
|
2011-07-23 20:06:42 +02:00
|
|
|
public function addDefinitionComplexType($type, Collection $complexType)
|
|
|
|
{
|
|
|
|
$this->complexTypes[$type] = $complexType;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getDefinitionComplexTypes()
|
|
|
|
{
|
|
|
|
return $this->complexTypes;
|
|
|
|
}
|
2010-10-07 15:16:56 +02:00
|
|
|
}
|