Correct a parameter order swap in "diffusion.historyquery" for Mercurial
[phabricator.git] / src / applications / almanac / util / AlmanacAddress.php
blob2d33579a32aa79c6f17f1d60388f6c242d6c3d4e
1 <?php
3 final class AlmanacAddress extends Phobject {
5 private $networkPHID;
6 private $address;
7 private $port;
9 private function __construct() {
10 // <private>
13 public function getNetworkPHID() {
14 return $this->networkPHID;
17 public function getAddress() {
18 return $this->address;
21 public function getPort() {
22 return $this->port;
25 public static function newFromDictionary(array $dictionary) {
26 return self::newFromParts(
27 $dictionary['networkPHID'],
28 $dictionary['address'],
29 $dictionary['port']);
32 public static function newFromParts($network_phid, $address, $port) {
33 $addr = new AlmanacAddress();
35 $addr->networkPHID = $network_phid;
36 $addr->address = $address;
37 $addr->port = (int)$port;
39 return $addr;
42 public function toDictionary() {
43 return array(
44 'networkPHID' => $this->getNetworkPHID(),
45 'address' => $this->getAddress(),
46 'port' => $this->getPort(),
50 public function toHash() {
51 return PhabricatorHash::digestForIndex(json_encode($this->toDictionary()));