host = $host; $this->priority = $maxPriority; $this->minPriority = $minPriority; $this->maxPriority = $maxPriority; $this->decrStep = $decrStep; $this->incrStep = $incrStep; } function __destruct() { } /** * @return string */ public function getHost() { return $this->host; } /** * @param $host */ public function setHost($host) { $this->host = $host; } /** * @return int */ public function getPriority() { return $this->priority; } /** * @param int $priority */ public function setPriority($priority) { $this->priority = $priority; } public function incrPriority() { $this->changePriority(true, $this->incrStep); } public function decrPriority() { $this->changePriority(false, $this->incrStep); } /** * @param bool $incr * @param int $step */ private function changePriority($incr, $step) { $newPriority = $incr ? $this->priority + $step : $this->priority - $step; if ($newPriority < $this->minPriority) { $newPriority = $this->minPriority; } if ($newPriority > $this->maxPriority) { $newPriority = $this->maxPriority; } $this->priority = $newPriority; } }