'away', self::STATUS_SPORADIC => 'sporadic', ); protected $userPHID; protected $dateFrom; protected $dateTo; protected $status; public function getTextStatus() { return self::$statusTexts[$this->status]; } public function getStatusDescription(PhabricatorUser $viewer) { $until = phabricator_date($this->dateTo, $viewer); if ($this->status == PhabricatorUserStatus::STATUS_SPORADIC) { return 'Sporadic until '.$until; } else { return 'Away until '.$until; } } public function setTextStatus($status) { $statuses = array_flip(self::$statusTexts); return $this->setStatus($statuses[$status]); } public function loadCurrentStatuses($user_phids) { $statuses = $this->loadAllWhere( 'userPHID IN (%Ls) AND UNIX_TIMESTAMP() BETWEEN dateFrom AND dateTo', $user_phids); return mpull($statuses, null, 'getUserPHID'); } }