@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
at recaptime-dev/main 58 lines 1.2 kB view raw
1<?php 2 3final class DrydockCommandError extends Phobject { 4 5 private $phase; 6 private $displayCommand; 7 private $command; 8 private $error; 9 private $stdout; 10 private $stderr; 11 12 public static function newFromCommandException(CommandException $ex) { 13 $error = new self(); 14 15 $error->command = (string)$ex->getCommand(); 16 17 $error->error = $ex->getError(); 18 $error->stdout = $ex->getStdout(); 19 $error->stderr = $ex->getStderr(); 20 21 return $error; 22 } 23 24 public function setPhase($phase) { 25 $this->phase = $phase; 26 return $this; 27 } 28 29 public function getPhase() { 30 return $this->phase; 31 } 32 33 public function setDisplayCommand($display_command) { 34 $this->displayCommand = (string)$display_command; 35 return $this; 36 } 37 38 public function getDisplayCommand() { 39 return $this->displayCommand; 40 } 41 42 public function toDictionary() { 43 $display_command = $this->getDisplayCommand(); 44 if ($display_command === null) { 45 $display_command = $this->command; 46 } 47 48 return array( 49 'phase' => $this->getPhase(), 50 'command' => $display_command, 51 'raw' => $this->command, 52 'err' => $this->error, 53 'stdout' => $this->stdout, 54 'stderr' => $this->stderr, 55 ); 56 } 57 58}