Firestore/src/WriteBatch.php
private function createDatabaseWriteOperation($type, $document, array $options = [])
    {
        switch ($type) {
            case self::TYPE_UPDATE:
                return [
                    'update' => [
                        'name' => $document,
                        'fields' => $this->pluck('fields', $options)
                    ]
                ];
                break;

            case self::TYPE_DELETE:
                return ['delete' => $document];
                break;

            case self::TYPE_TRANSFORM:
                return [
                    'transform' => [
                        'document' => $document,
                        'fieldTransforms' => $this->pluck('fieldTransforms', $options)
                    ]
                ];
                break;

            // @codeCoverageIgnoreStart
            default:
                throw new \InvalidArgumentException(sprintf(
                    'Write operation type `%s is not valid. Allowed values are update, delete, verify, transform.',
                    $type
                ));
                break;
            // @codeCoverageIgnoreEnd
        }
    }
private function createDatabaseWriteOperation($type, $document, array $options = [])
    {
        switch ($type) {
            case self::TYPE_UPDATE:
                return [
                    'update' => [
                        'name' => $document,
                        'fields' => $this->pluck('fields', $options)
                    ]
                ];
                break;

            case self::TYPE_DELETE:
                return ['delete' => $document];
                break;

            case self::TYPE_TRANSFORM:
                return [
                    'transform' => [
                        'document' => $document,
                        'fieldTransforms' => $this->pluck('fieldTransforms', $options)
                    ]
                ];
                break;

            // @codeCoverageIgnoreStart
            default:
                throw new \InvalidArgumentException(sprintf(
                    'Write operation type `%s is not valid. Allowed values are update, delete, verify, transform.',
                    $type
                ));
                break;
            // @codeCoverageIgnoreEnd
        }
    }
private function createDatabaseWriteOperation ( $ type , $ document , array $ options = [ ] ) { switch ( $ type ) { case self :: TYPE_UPDATE : return [ 'update' => [ 'name' => $ document , 'fields' => $ this -> pluck ( 'fields' , $ options ) ] ] ; break ; case self :: TYPE_DELETE : return [ 'delete' => $ document ] ; break ; case self :: TYPE_TRANSFORM : return [ 'transform' => [ 'document' => $ document , 'fieldTransforms' => $ this -> pluck ( 'fieldTransforms' , $ options ) ] ] ; break ; // @codeCoverageIgnoreStart default : throw new \ InvalidArgumentException ( sprintf ( 'Write operation type `%s is not valid. Allowed values are update, delete, verify, transform.' , $ type ) ) ; break ; // @codeCoverageIgnoreEnd } }
Create the write operation object.

@param string $type The write type.
@param string $document The document to target, either
as a string document name, or DocumentReference object.
@param array $options Configuration Options.
@return array
@throws \InvalidArgumentException If $type is not a valid value.
Create the write operation object .