1<?php 2 3final class ArcanistBuildableRef 4 extends ArcanistRef { 5 6 const HARDPOINT_BUILDREFS = 'ref.buildable.buildRefs'; 7 8 private $parameters; 9 10 protected function newHardpoints() { 11 $object_list = new ArcanistObjectListHardpoint(); 12 return array( 13 $this->newTemplateHardpoint( 14 self::HARDPOINT_BUILDREFS, 15 $object_list), 16 ); 17 } 18 19 public function getRefDisplayName() { 20 return pht('Buildable "%s"', $this->getMonogram()); 21 } 22 23 public static function newFromConduit(array $parameters) { 24 $ref = new self(); 25 $ref->parameters = $parameters; 26 return $ref; 27 } 28 29 public function getID() { 30 return idx($this->parameters, 'id'); 31 } 32 33 public function getPHID() { 34 return idx($this->parameters, 'phid'); 35 } 36 37 public function getObjectPHID() { 38 return idxv($this->parameters, array('fields', 'objectPHID')); 39 } 40 41 public function getMonogram() { 42 return 'B'.$this->getID(); 43 } 44 45 protected function buildRefView(ArcanistRefView $view) { 46 $view 47 ->setObjectName($this->getMonogram()) 48 ->setTitle($this->getRefDisplayName()); 49 } 50 51 public function getBuildRefs() { 52 return $this->getHardpoint(self::HARDPOINT_BUILDREFS); 53 } 54 55 public function getURI() { 56 $uri = idxv($this->parameters, array('fields', 'uri')); 57 58 if ($uri === null) { 59 $uri = '/'.$this->getMonogram(); 60 } 61 62 return $uri; 63 } 64 65} 66