} public static function newFromScalar($scalar) { // If the string is something like "-id", strip the "-" off and mark it // as reversed. $is_reversed = false; if (!strncmp($scalar, '-', 1)) { $is_reversed = true; $scalar = substr($scalar, 1); } $item = new PhabricatorQueryOrderItem(); $item->orderKey = $scalar; $item->isReversed = $is_reversed; return $item; } public function getIsReversed() { return $this->isReversed; } public function getOrderKey() { return $this->orderKey; } public function getAsScalar() { if ($this->getIsReversed()) { $prefix = '-'; } else { $prefix = ''; } return $prefix.$this->getOrderKey(); } }