private function removeSentinel(array $fields, array &$timestamps, array &$deletes, $path = '')
    {
        if ($path !== '') {
            $path .= '.';
        }

        foreach ($fields as $key => $value) {
            $currPath = $path . (string) $this->escapePathPart($key);
            if (is_array($value)) {
                $fields[$key] = $this->removeSentinel($value, $timestamps, $deletes, $currPath);
            } else {
                if ($value === FieldValue::deleteField() || $value === FieldValue::serverTimestamp()) {
                    if ($value === FieldValue::deleteField()) {
                        $deletes[] = $currPath;
                    }

                    if ($value === FieldValue::serverTimestamp()) {
                        $timestamps[] = $currPath;
                    }

                    unset($fields[$key]);
                }
            }
        }

        return $fields;
    }
private function removeSentinel(array $fields, array &$timestamps, array &$deletes, $path = '')
    {
        if ($path !== '') {
            $path .= '.';
        }

        foreach ($fields as $key => $value) {
            $currPath = $path . (string) $this->escapePathPart($key);
            if (is_array($value)) {
                $fields[$key] = $this->removeSentinel($value, $timestamps, $deletes, $currPath);
            } else {
                if ($value === FieldValue::deleteField() || $value === FieldValue::serverTimestamp()) {
                    if ($value === FieldValue::deleteField()) {
                        $deletes[] = $currPath;
                    }

                    if ($value === FieldValue::serverTimestamp()) {
                        $timestamps[] = $currPath;
                    }

                    unset($fields[$key]);
                }
            }
        }

        return $fields;
    }
private function removeSentinel ( array $ fields , array & $ timestamps , array & $ deletes , $ path = '' ) { if ( $ path !== '' ) { $ path .= '.' ; } foreach ( $ fields as $ key => $ value ) { $ currPath = $ path . ( string ) $ this -> escapePathPart ( $ key ) ; if ( is_array ( $ value ) ) { $ fields [ $ key ] = $ this -> removeSentinel ( $ value , $ timestamps , $ deletes , $ currPath ) ; } else { if ( $ value === FieldValue :: deleteField ( ) || $ value === FieldValue :: serverTimestamp ( ) ) { if ( $ value === FieldValue :: deleteField ( ) ) { $ deletes [ ] = $ currPath ; } if ( $ value === FieldValue :: serverTimestamp ( ) ) { $ timestamps [ ] = $ currPath ; } unset ( $ fields [ $ key ] ) ; } } } return $ fields ; }
Recurse through fields and find and remove sentinel values.

@param array $fields The input field data.
@param array $timestamps The timestamps field paths. (reference)
@param array $deletes the deletes field paths. (reference)
@param string $path The current field path.
@return array
Recurse through fields and find and remove sentinel values .