status === self::STATUS_STOPPED; } /** * @return bool */ public function isRunning() { return $this->status === self::STATUS_RUNNING; } public function isSleeping() { return $this->status === self::STATUS_SLEEPING; } /** * @return $this */ public function setRunning() { $this->setStatus(self::STATUS_RUNNING); return $this; } /** * @return $this */ public function setStopped() { $this->setStatus(self::STATUS_STOPPED); return $this; } /** * @return $this */ public function setSleeping() { $this->setStatus(self::STATUS_SLEEPING); return $this; } /** * @param $status * @return $this */ public function setStatus($status) { $this->status = $status; $this->save(); return $this; } /** * @return $this */ public function start() { $this->setAction(self::ACTION_START); return $this; } /** * @return $this */ public function stop() { $this->setAction(self::ACTION_STOP); return $this; } /** * @return $this */ public function reboot() { $this->setAction(self::ACTION_REBOOT); return $this; } /** * */ public function ping() { $this->touch(); $this->save(); } /** * @return $this */ public function clearAction() { $this->setAction(self::ACTION_NONE); return $this; } /** * @param $action * @return $this */ public function setAction($action) { $this->action = $action; $this->save(); return $this; } /** * @return bool */ public function shouldBeStopped() { return $this->action === self::ACTION_STOP; } public function shouldBeRestared() { return $this->action === self::ACTION_REBOOT; } }