/**
  * @param mixed $name name of the property to change
  * @param mixed $value new value for the property
  * @return void
  */
 public function __set($name, $value)
 {
     if (isset($this->_cache['subs'][$name]) && !$this->_cache['subs'][$name]['dynamic']) {
         trigger_error('Property ' . $name . ' is not a parameter', E_USER_ERROR);
     } elseif (isset($this->_cache['params'][$name])) {
         if (is_scalar($value) || $value instanceof \DateTime) {
             if (!isset($this->_params[$name])) {
                 $this->_params[$name] = ParameterFactory::factory($this->_cache['params'][$name]);
             }
             $this->_params[$name]->set($value);
         } elseif (is_array($value)) {
             // recreate param to reset other keys and keep scalar value if existent
             $v = isset($this->_params[$name]) && is_scalar($this->_params[$name]->value()) ? $this->_params[$name]->value() : null;
             $this->_params[$name] = ParameterFactory::factory($this->_cache['params'][$name]);
             $this->_params[$name]->value($v);
             // proceed array
             if ($this->_params[$name] instanceof ParameterArrayType) {
                 foreach ($value as $key => $v) {
                     $this->_params[$name][$key] = $v;
                 }
             } else {
                 foreach ($value as $key => $v) {
                     $this->_params[$name]->{$key} = $v;
                 }
             }
         } else {
             trigger_error("Invalid value for property " . $name, E_USER_ERROR);
         }
     } else {
         trigger_error("Property " . $name . " does not exist", E_USER_ERROR);
     }
 }
 /**
  * @param mixed|null $value sets the value of this parameter if $value is not null
  * @return mixed|null
  */
 public function value($value = null)
 {
     if ($this->hasChilds()) {
         if ($value === null) {
             $r = array();
             foreach ($this->_subparams as $name => $param) {
                 $v = $param->get();
                 if ($v !== null) {
                     $r[$name] = $v;
                 }
             }
             if (count($r) > 0) {
                 return $r;
             } else {
                 return null;
             }
         } else {
             if (is_array($value)) {
                 $this->_subparams = array();
                 foreach ($value as $key => $v) {
                     if (array_key_exists($key, $this->_cache['subparams'])) {
                         if (!isset($this->_subparams[$key])) {
                             $this->_subparams[$key] = ParameterFactory::factory($this->_cache['subparams'][$key]);
                         }
                         $this->_subparams[$key]->value($v);
                     } else {
                         trigger_error("Property " . $key . " does not exist", E_USER_ERROR);
                     }
                 }
             } else {
                 trigger_error("Can not set value of Parameter with subparameters", E_USER_ERROR);
             }
         }
     } else {
         if ($value !== null) {
             if (is_scalar($value) || $value instanceof \DateTime) {
                 if ($this->_strict) {
                     trigger_error("Can not set a scalar value to a Parameter which is in all operations an Array.", E_USER_ERROR);
                 } else {
                     $this->_value = $value;
                 }
             } else {
                 trigger_error("Property value must be scalar.", E_USER_ERROR);
             }
         }
         return $this->_value;
     }
 }