public function unsetField($selector)
{
// modify
$arraySelector = explode('.', $selector);
$chunksNum = count($arraySelector);
// optimize one-level selector search
if (1 == $chunksNum) {
// check if field exists
if (isset($this->data[$selector])) {
// unset field
unset($this->data[$selector]);
// mark field as modified
$this->modifiedFields[] = $selector;
}
return $this;
}
// find section
$section =& $this->data;
for ($i = 0; $i < $chunksNum - 1; $i++) {
$field = $arraySelector[$i];
if (!isset($section[$field])) {
return $this;
}
$section =& $section[$field];
}
// check if field exists
if (isset($section[$arraySelector[$chunksNum - 1]])) {
// unset field
unset($section[$arraySelector[$chunksNum - 1]]);
// mark field as modified
$this->modifiedFields[] = $selector;
}
return $this;
}