Firestore/src/WriteBatch.php
private function formatPrecondition(array $options, $mustExist = false)
    {
        if (!isset($options['precondition']) && !$mustExist) {
            return $options;
        }

        $precondition = isset($options['precondition'])
            ? $options['precondition']
            : [];

        if (isset($precondition['updateTime'])) {
            return $options;
        }

        if ($mustExist) {
            $precondition['exists'] = true;
        }

        $options['precondition'] = $precondition;

        return $options;
    }
private function formatPrecondition(array $options, $mustExist = false)
    {
        if (!isset($options['precondition']) && !$mustExist) {
            return $options;
        }

        $precondition = isset($options['precondition'])
            ? $options['precondition']
            : [];

        if (isset($precondition['updateTime'])) {
            return $options;
        }

        if ($mustExist) {
            $precondition['exists'] = true;
        }

        $options['precondition'] = $precondition;

        return $options;
    }
private function formatPrecondition ( array $ options , $ mustExist = false ) { if ( ! isset ( $ options [ 'precondition' ] ) && ! $ mustExist ) { return $ options ; } $ precondition = isset ( $ options [ 'precondition' ] ) ? $ options [ 'precondition' ] : [ ] ; if ( isset ( $ precondition [ 'updateTime' ] ) ) { return $ options ; } if ( $ mustExist ) { $ precondition [ 'exists' ] = true ; } $ options [ 'precondition' ] = $ precondition ; return $ options ; }
Correctly formats a precondition for a write.

@param array $options Configuration options input.
@param bool $mustExist If true, the precondition will always include at
least `exists=true` precondition. **Defaults to** `false`.
@return array Modified configuration options.
Correctly formats a precondition for a write .