public function exchangeArray(array $data)
{
foreach ($data as $key => $value) {
$key = strtolower($key);
$key = str_replace('_', '', $key);
switch ($key) {
case 'acceptwhitelist':
if (!is_array($value)) {
throw new InvalidArgumentException(sprintf('%s expects an array value for "%s"; received "%s"', __CLASS__, is_object($value) ? get_class($value) : gettype($value)));
}
$this->acceptWhitelist = $value;
break;
case 'contenttypewhitelist':
if (!is_array($value)) {
throw new InvalidArgumentException(sprintf('%s expects an array value for "%s"; received "%s"', __CLASS__, is_object($value) ? get_class($value) : gettype($value)));
}
$this->contentTypeWhitelist = $value;
break;
case 'controllerclass':
$this->controllerClass = $value;
break;
case 'controllerservicename':
$this->controllerServiceName = $value;
break;
case 'httpmethods':
if (!is_array($value)) {
throw new InvalidArgumentException(sprintf('%s expects an array value for "%s"; received "%s"', __CLASS__, is_object($value) ? get_class($value) : gettype($value)));
}
$this->httpMethods = $value;
break;
case 'inputfilters':
if ($value instanceof InputFilterCollection || $value instanceof HalCollection) {
$this->inputFilters = $value;
}
break;
case 'documentation':
$this->documentation = $value;
break;
case 'routematch':
$this->routeMatch = $value;
break;
case 'routename':
$this->routeName = $value;
break;
case 'selector':
$this->selector = $value;
break;
case 'servicename':
$this->serviceName = $value;
break;
default:
break;
}
}
if (empty($this->controllerServiceName) || !is_string($this->controllerServiceName)) {
throw new RuntimeException(sprintf('%s requires a controller service name; none present following population', __CLASS__));
}
}