Go to the documentation of this file.00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00015 final class ColorArray
00016 {
00017 private $colors = array();
00018
00022 public function add(Color $color)
00023 {
00024 $this->colors[] = $color;
00025
00026 return $this;
00027 }
00028
00032 public function clear()
00033 {
00034 unset($this->colors);
00035
00036 return $this;
00037 }
00038
00043 public function getRandomTextColor()
00044 {
00045 if ($this->isEmpty())
00046 throw new MissingElementException();
00047
00048 return $this->colors[array_rand($this->colors)];
00049 }
00050
00051 public function getColors()
00052 {
00053 return $this->colors;
00054 }
00055
00056 public function isEmpty()
00057 {
00058 if (count($this->colors) == 0)
00059 return true;
00060 else
00061 return false;
00062 }
00063 }
00064 ?>