Пример #1
0
 /**
  * @param $string
  * @return static
  * @throws InvalidColorNameException
  */
 public static function fromString($string)
 {
     if (!($hex = ColorList::getHexFromName($string))) {
         throw new InvalidColorNameException($string);
     }
     return new static($hex);
 }
Пример #2
0
 public function testGetHexFromName()
 {
     $this->assertEquals('FF0000', ColorList::getHexFromName('Red'));
     $this->assertEquals('FF0000', ColorList::getHexFromName('red'));
 }