/** * @param $hex * @return bool */ public static function getNameFromHex($hex) { $hex = HexValidator::validateHex($hex); foreach (self::getAll() as $color) { if ($color[0] == $hex) { return $color[1]; } } return false; }
/** * Color constructor. * @param $originalHex * @param $colourName * @param $hex */ public function __construct($originalHex, $colourName, $hex) { $this->originalHex = HexValidator::validateHex($originalHex); $this->colourName = $colourName; $this->hex = HexValidator::validateHex($hex); }