2010-10-07 15:16:56 +02:00
|
|
|
<?php
|
2010-10-08 17:01:27 +02:00
|
|
|
/*
|
|
|
|
* This file is part of the WebServiceBundle.
|
|
|
|
*
|
|
|
|
* (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
|
|
|
|
|
|
|
namespace Bundle\WebServiceBundle\ServiceDefinition;
|
|
|
|
|
|
|
|
use Bundle\WebServiceBundle\Util\Collection;
|
|
|
|
|
|
|
|
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
|
|
|
/**
|
|
|
|
* @var \Bundle\WebServiceBundle\Util\Collection
|
|
|
|
*/
|
|
|
|
private $methods;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @var \Bundle\WebServiceBundle\Util\Collection
|
|
|
|
*/
|
|
|
|
private $headers;
|
|
|
|
|
2011-02-03 01:04:12 +01:00
|
|
|
public function __construct($name = null, $namespace = null, array $methods = array(), array $headers = array())
|
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
|
|
|
|
|
|
|
$this->methods = new Collection('getName', 'Bundle\WebServiceBundle\ServiceDefinition\Method');
|
|
|
|
$this->headers = new Collection('getName', 'Bundle\WebServiceBundle\ServiceDefinition\Header');
|
|
|
|
|
2010-10-07 15:16:56 +02:00
|
|
|
$this->setMethods($methods);
|
|
|
|
$this->setHeaders($headers);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @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
|
|
|
/**
|
|
|
|
* @return \Bundle\WebServiceBundle\Util\Collection
|
|
|
|
*/
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return \Bundle\WebServiceBundle\Util\Collection
|
|
|
|
*/
|
|
|
|
public function getHeaders()
|
|
|
|
{
|
|
|
|
return $this->headers;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param array $headers
|
|
|
|
*/
|
2011-07-17 10:46:54 +02:00
|
|
|
public function setHeaders(array $headers)
|
2010-10-07 15:16:56 +02:00
|
|
|
{
|
|
|
|
$this->headers->addAll($headers);
|
|
|
|
}
|
2011-07-17 15:08:46 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
public function getAllTypes()
|
|
|
|
{
|
|
|
|
$types = array();
|
|
|
|
|
|
|
|
foreach($this->methods as $method) {
|
|
|
|
foreach($method->getArguments() as $argument) {
|
|
|
|
$types[] = $argument->getType();
|
|
|
|
}
|
|
|
|
|
|
|
|
$types[] = $method->getReturn();
|
|
|
|
}
|
|
|
|
|
|
|
|
return $types;
|
|
|
|
}
|
2010-10-07 15:16:56 +02:00
|
|
|
}
|