SoapResponse is a product of SoapResponseFactory, small refactorings

This commit is contained in:
Petr Bechyně
2016-11-02 16:08:21 +01:00
parent bf494a42b5
commit 8d033f9afc
7 changed files with 89 additions and 146 deletions

View File

@ -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) {