1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60:
<?php
namespace LeanCloud\Operation;
class DeleteOperation implements IOperation {
/**
* The key of field the operation is about to apply
*
* @var string
*/
private $key;
/**
* Initialize operation
*
* @param string $key Key of field to delete.
*/
public function __construct($key) {
$this->key = $key;
}
/**
* Get key of field the operation applies to.
*
* @return string
*/
public function getKey() {
return $this->key;
}
/**
* Encode to JSON represented operation
*
* @return array
*/
public function encode() {
return array("__op" => "Delete");
}
/**
* Apply this operation on an old value.
*
* @param mixed $oldval
* @return null
*/
public function applyOn($oldval=null) {
return null;
}
/**
* Merge this operation with (previous) operation.
*
* @param IOperation $prevOp
* @return IOperation
*/
public function mergeWith($prevOp) {
return $this;
}
}