public function saveState(array &$params, $reflection = NULL)
{
$reflection = $reflection === NULL ? $this->getReflection() : $reflection;
foreach ($reflection->getPersistentParams() as $name => $meta) {
if (isset($params[$name])) {
// injected value
} elseif (array_key_exists($name, $params)) {
// NULLs are skipped
continue;
} elseif ((!isset($meta['since']) || $this instanceof $meta['since']) && isset($this->{$name})) {
$params[$name] = $this->{$name};
// object property value
} else {
continue;
// ignored parameter
}
$type = gettype($meta['def']);
if (!ComponentReflection::convertType($params[$name], $type)) {
throw new InvalidLinkException(sprintf("Value passed to persistent parameter '%s' in %s must be %s, %s given.", $name, $this instanceof Presenter ? 'presenter ' . $this->getName() : "component '{$this->getUniqueId()}'", $type === 'NULL' ? 'scalar' : $type, is_object($params[$name]) ? get_class($params[$name]) : gettype($params[$name])));
}
if ($params[$name] === $meta['def'] || $meta['def'] === NULL && $params[$name] === '') {
$params[$name] = NULL;
// value transmit is unnecessary
}
}
}