Correct a parameter order swap in "diffusion.historyquery" for Mercurial
[phabricator.git] / src / applications / transactions / editengine / PhabricatorEditEngineLock.php
blob6de116bd6f19f98396c5a95e835d74565abacaa7
1 <?php
3 abstract class PhabricatorEditEngineLock
4 extends Phobject {
6 private $viewer;
7 private $object;
9 final public function setViewer(PhabricatorUser $viewer) {
10 $this->viewer = $viewer;
11 return $this;
14 final public function getViewer() {
15 return $this->viewer;
18 final public function setObject($object) {
19 $this->object = $object;
20 return $this;
23 final public function getObject() {
24 return $this->object;
27 public function willPromptUserForLockOverrideWithDialog(
28 AphrontDialogView $dialog) {
30 return $dialog
31 ->setTitle(pht('Edit Locked Object'))
32 ->appendParagraph(pht('This object is locked. Edit it anyway?'))
33 ->addSubmitButton(pht('Override Lock'));
36 public function willBlockUserInteractionWithDialog(
37 AphrontDialogView $dialog) {
39 return $dialog
40 ->setTitle(pht('Object Locked'))
41 ->appendParagraph(
42 pht('You can not interact with this object because it is locked.'));
45 public function getLockedObjectDisplayText() {
46 return pht('This object has been locked.');
49 public static function newForObject(
50 PhabricatorUser $viewer,
51 $object) {
53 if ($object instanceof PhabricatorEditEngineLockableInterface) {
54 $lock = $object->newEditEngineLock();
55 } else {
56 $lock = new PhabricatorEditEngineDefaultLock();
59 return $lock
60 ->setViewer($viewer)
61 ->setObject($object);