Changeset View
Changeset View
Standalone View
Standalone View
src/ref/ArcanistDisplayRef.php
<?php | <?php | ||||
final class ArcanistDisplayRef | final class ArcanistDisplayRef | ||||
extends Phobject | extends Phobject | ||||
implements | implements | ||||
ArcanistTerminalStringInterface { | ArcanistTerminalStringInterface { | ||||
private $ref; | private $ref; | ||||
private $uri; | |||||
public function setRef(ArcanistRef $ref) { | public function setRef(ArcanistRef $ref) { | ||||
$this->ref = $ref; | $this->ref = $ref; | ||||
return $this; | return $this; | ||||
} | } | ||||
public function getRef() { | public function getRef() { | ||||
return $this->ref; | return $this->ref; | ||||
} | } | ||||
public function setURI($uri) { | |||||
$this->uri = $uri; | |||||
return $this; | |||||
} | |||||
public function getURI() { | |||||
return $this->uri; | |||||
} | |||||
public function newTerminalString() { | public function newTerminalString() { | ||||
$ref = $this->getRef(); | $ref = $this->getRef(); | ||||
if ($ref instanceof ArcanistDisplayRefInterface) { | if ($ref instanceof ArcanistDisplayRefInterface) { | ||||
$object_name = $ref->getDisplayRefObjectName(); | $object_name = $ref->getDisplayRefObjectName(); | ||||
$title = $ref->getDisplayRefTitle(); | $title = $ref->getDisplayRefTitle(); | ||||
} else { | } else { | ||||
$object_name = null; | $object_name = null; | ||||
Show All 28 Lines | if ($object_name !== null) { | ||||
} else { | } else { | ||||
$display_text = tsprintf('**%s**', $object_name); | $display_text = tsprintf('**%s**', $object_name); | ||||
} | } | ||||
} else { | } else { | ||||
$display_text = $title; | $display_text = $title; | ||||
} | } | ||||
$ref = $this->getRef(); | $ref = $this->getRef(); | ||||
return tsprintf( | $output = array(); | ||||
$output[] = tsprintf( | |||||
"<bg:cyan>** * **</bg> %s\n", | "<bg:cyan>** * **</bg> %s\n", | ||||
$display_text); | $display_text); | ||||
$uri = $this->getURI(); | |||||
if ($uri !== null) { | |||||
$output[] = tsprintf( | |||||
"<bg:cyan>** :// **</bg> __%s__\n", | |||||
$uri); | |||||
} | |||||
return $output; | |||||
} | } | ||||
} | } |