. */ class BackgroundStyle { /** * @todo I suspect using stripe and gradient are mutually * exclusive, so it would be possible to simplify this interface * somewhat. */ public function __construct(Color $backgroundColor, $stripe = false, Color $gradientStartColor = null, $gradientDecay = null, $borderWidth = 1, $borderDotSize = 0) { $this->backgroundColor = $backgroundColor; $this->stripe = $stripe; $this->gradientStartColor = $gradientStartColor; $this->gradientDecay = $gradientDecay; $this->borderWidth = $borderWidth; $this->borderDotSize = $borderDotSize; } public function getBackgroundColor() { return $this->backgroundColor; } public function useStripe() { return $this->stripe; } public function useGradient() { return $this->gradientStartColor != null; } public function getGradientStartColor() { if($this->gradientStartColor == null) { throw new Exception("Requested gradient start color, but gradient is not enabled"); } return $this->gradientStartColor; } public function getGradientDecay() { if($this->gradientStartColor == null) { throw new Exception("Requested gradient decay, but gradient is not enabled"); } return $this->gradientDecay; } public function getBorderWidth() { return $this->borderWidth; } public function getBorderDotSize() { return $this->borderDotSize; } private $backgroundColor; private $stripe; private $gradientStartColor; private $gradientDecay; private $borderWidth; private $borderDotSize; }