Changeset View
Changeset View
Standalone View
Standalone View
src/conduit/ArcanistConduitEngine.php
Show All 40 Lines | final class ArcanistConduitEngine | ||||
public function newFuture($method, array $parameters) { | public function newFuture($method, array $parameters) { | ||||
if ($this->conduitURI == null && $this->client === null) { | if ($this->conduitURI == null && $this->client === null) { | ||||
$this->raiseURIException(); | $this->raiseURIException(); | ||||
} | } | ||||
$future = $this->getClient()->callMethod($method, $parameters); | $future = $this->getClient()->callMethod($method, $parameters); | ||||
$call_future = id(new ArcanistConduitCallFuture($future)) | $call_future = (new ArcanistConduitCallFuture($future)) | ||||
->setEngine($this); | ->setEngine($this); | ||||
return $call_future; | return $call_future; | ||||
} | } | ||||
private function getClient() { | private function getClient() { | ||||
if (!$this->client) { | if (!$this->client) { | ||||
$conduit_uri = $this->getConduitURI(); | $conduit_uri = $this->getConduitURI(); | ||||
Show All 12 Lines | if (!$this->client) { | ||||
$this->client = $client; | $this->client = $client; | ||||
} | } | ||||
return $this->client; | return $this->client; | ||||
} | } | ||||
private function raiseURIException() { | private function raiseURIException() { | ||||
$list = id(new PhutilConsoleList()) | $list = (new PhutilConsoleList()) | ||||
->addItem( | ->addItem( | ||||
pht( | pht( | ||||
'Run in a working copy with "phabricator.uri" set in ".arcconfig".')) | 'Run in a working copy with "phabricator.uri" set in ".arcconfig".')) | ||||
->addItem( | ->addItem( | ||||
pht( | pht( | ||||
'Set a default URI with `arc set-config phabricator.uri <uri>`.')) | 'Set a default URI with `arc set-config phabricator.uri <uri>`.')) | ||||
->addItem( | ->addItem( | ||||
pht( | pht( | ||||
'Specify a URI explicitly with `--config phabricator.uri=<uri>`.')); | 'Specify a URI explicitly with `--config phabricator.uri=<uri>`.')); | ||||
$block = id(new PhutilConsoleBlock()) | $block = (new PhutilConsoleBlock()) | ||||
->addParagraph( | ->addParagraph( | ||||
pht( | pht( | ||||
'This command needs to communicate with a server, but no '. | 'This command needs to communicate with a server, but no '. | ||||
'server URI is configured.')) | 'server URI is configured.')) | ||||
->addList($list); | ->addList($list); | ||||
throw new ArcanistUsageException($block->drawConsoleString()); | throw new ArcanistUsageException($block->drawConsoleString()); | ||||
} | } | ||||
Show All 10 Lines |
Content licensed under Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) unless otherwise noted; code licensed under Apache 2.0 or other open source licenses. · CC BY-SA 4.0 · Apache 2.0