color = $color; return $this; } final public function setCaption($text) { $this->caption = $text; return $this; } final protected function getColor() { $color = $this->color; if (!$color) { $color = $this->getDefaultColor(); } switch ($color) { case self::COLOR_DEFAULT: case self::COLOR_WARNING: case self::COLOR_DANGER: return $color; } $ratio = $this->getRatio(); if ($color === self::COLOR_AUTO_GOODNESS) { $ratio = 1.0 - $ratio; } if ($ratio >= self::THRESHOLD_DANGER) { return self::COLOR_DANGER; } else if ($ratio >= self::THRESHOLD_WARNING) { return self::COLOR_WARNING; } else { return self::COLOR_DEFAULT; } } final protected function getCaption() { return $this->caption; } }