SoapResponse is a product of SoapResponseFactory, small refactorings
This commit is contained in:
@ -18,6 +18,7 @@ namespace BeSimple\SoapCommon;
|
||||
class ClassMap
|
||||
{
|
||||
protected $classMap;
|
||||
protected $inverseClassMap;
|
||||
|
||||
public function __construct(array $classMap = [])
|
||||
{
|
||||
@ -61,6 +62,7 @@ class ClassMap
|
||||
}
|
||||
|
||||
$this->classMap[$type] = $className;
|
||||
$this->inverseClassMap[$className] = $type;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -72,6 +74,20 @@ class ClassMap
|
||||
return isset($this->classmap[$type]);
|
||||
}
|
||||
|
||||
public function getByClassName($className)
|
||||
{
|
||||
if (!$this->hasByClassName($className)) {
|
||||
throw new \InvalidArgumentException(sprintf('The className "%s" was not found in %s', $className, __CLASS__));
|
||||
}
|
||||
|
||||
return $this->inverseClassMap[$className];
|
||||
}
|
||||
|
||||
public function hasByClassName($className)
|
||||
{
|
||||
return isset($this->inverseClassMap[$className]);
|
||||
}
|
||||
|
||||
public function addClassMap(ClassMap $classMap)
|
||||
{
|
||||
foreach ($classMap->getAll() as $type => $className) {
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
namespace BeSimple\SoapCommon;
|
||||
|
||||
use BeSimple\SoapCommon\Mime\Part as MimePart;
|
||||
|
||||
/**
|
||||
* SoapKernel provides methods to pre- and post-process SoapRequests and SoapResponses using
|
||||
* chains of SoapRequestFilter and SoapResponseFilter objects (roughly following
|
||||
@ -14,40 +12,6 @@ use BeSimple\SoapCommon\Mime\Part as MimePart;
|
||||
*/
|
||||
class SoapKernel
|
||||
{
|
||||
/**
|
||||
* Add attachment.
|
||||
*
|
||||
* @param \BeSimple\SoapCommon\Mime\Part $attachment New attachment
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function addAttachment(MimePart $attachment)
|
||||
{
|
||||
$contentId = trim($attachment->getHeader('Content-ID'), '<>');
|
||||
|
||||
$this->attachments[$contentId] = $attachment;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get attachment and remove from array.
|
||||
*
|
||||
* @param string $contentId Content ID of attachment
|
||||
*
|
||||
* @return \BeSimple\SoapCommon\Mime\Part|null
|
||||
*/
|
||||
public function getAttachment($contentId)
|
||||
{
|
||||
if (isset($this->attachments[$contentId])) {
|
||||
$part = $this->attachments[$contentId];
|
||||
unset($this->attachments[$contentId]);
|
||||
|
||||
return $part;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Applies all registered SoapRequestFilter to the given SoapRequest.
|
||||
*
|
||||
|
Reference in New Issue
Block a user